예제 #1
0
 def set_aes_key(self, msg_e, signature):
     vr = auth.verify_signature(self.secret, self.salt, msg_e, signature)
     if vr:
         k = qcrypt.pub_decrypt(msg_e, self.pri_key)
         self.aes_key = k
         self.key_agreement = True
         msg = qcrypt.aes_encrypt(AES_SET_MSG, self.aes_key)
         signature = auth.sign_msg(self.partner_secret_hash, msg)
         self.send('confirm_aeskey', msg, signature)
         print 'set aes key. key agreement reached'
     else:
         k = None
         self.send('bad_aeskey', None)
         self.key_agreement = False
         print 'incorrect message signature'
     self.aes_key = k
     return k
예제 #2
0
 def send_message(self, msg):
     msg = qcrypt.aes_encrypt(msg, self.aes_key)
     self.send('message', msg)