def format_msg(self, cmd, msg, sig=None): if sig: d = {'cmd':cmd, 'msg':msg, 'sig':sig} else: d = {'cmd':cmd, 'msg':msg} return nDDB.encode(d)
def request_pub_key(self): k = self.pri_key.publickey().__getstate__() msg = qcrypt.normalize(nDDB.encode(k)) signature = auth.sign_msg(self.partner_secret_hash, msg) self.send('set_pub_key', msg, signature) print 'sent signed public key'