예제 #1
0
 def send_encryption_key_request(self, c):
     """
     STEP 2.2: substitute our own key for the client side
     """
     pubkey = encryption.export_pubkey(self.factory.rsakey)
     c.public_key_length = len(pubkey)
     c.public_key = pubkey
     c.token_length = 4
     c.verify_token = encryption.get_random_bytes(c.token_length)
     self.sendData(chr(253) + packets[253].build(c))
예제 #2
0
 def send_encryption_key_request(self, c):
     """
     STEP 2.2: substitute our own key for the client side
     """
     pubkey = encryption.export_pubkey(self.factory.rsakey)
     c.public_key_length = len(pubkey)
     c.public_key = pubkey
     c.token_length = 4
     c.verify_token = encryption.get_random_bytes(c.token_length)
     self.sendData(chr(253) + packets[253].build(c))
예제 #3
0
 def on_encryption_key_request(self, c):
     """
     STEP 2.1:
     decode encryption request from the server
     use it for the server side
     """
     aes_key = encryption.get_random_bytes()
     self.cipher = encryption.make_aes(aes_key, aes_key)
     self.decipher = encryption.make_aes(aes_key, aes_key)
     public_key = encryption.load_pubkey(c.public_key)
     self.enc_shared_sercet = encryption.encrypt(aes_key, public_key)
     self.enc_4bytes = encryption.encrypt(c.verify_token, public_key)
예제 #4
0
 def on_encryption_key_request(self, c):
     """
     STEP 2.1:
     decode encryption request from the server
     use it for the server side
     """
     aes_key = encryption.get_random_bytes()
     self.cipher = encryption.make_aes(aes_key, aes_key)
     self.decipher = encryption.make_aes(aes_key, aes_key)
     public_key = encryption.load_pubkey(c.public_key)
     self.enc_shared_sercet = encryption.encrypt(aes_key, public_key)
     self.enc_4bytes = encryption.encrypt(c.verify_token, public_key)