plugin otr: priv_key is better than getPrivKey here, as it should not be None + fixed private key encryption/decryption
This commit is contained in:
parent
5dce151148
commit
20ea92ce1c
1 changed files with 4 additions and 2 deletions
|
|
@ -130,7 +130,9 @@ class Account(potr.context.Account):
|
|||
|
||||
def savePrivkey(self):
|
||||
log.debug(u"savePrivkey")
|
||||
priv_key = self.getPrivkey().serializePrivateKey()
|
||||
if self.privkey is None:
|
||||
raise exceptions.InternalError(_("Save is called but privkey is None !"))
|
||||
priv_key = self.privkey.serializePrivateKey().encode('hex')
|
||||
d = self.host.memory.encryptValue(priv_key, self.client.profile)
|
||||
def save_encrypted_key(encrypted_priv_key):
|
||||
self.client.otr_data[PRIVATE_KEY] = encrypted_priv_key
|
||||
|
|
@ -193,7 +195,7 @@ class OTR(object):
|
|||
encrypted_priv_key = client.otr_data.get(PRIVATE_KEY, None)
|
||||
if encrypted_priv_key is not None:
|
||||
priv_key = yield self.host.memory.decryptValue(encrypted_priv_key, profile)
|
||||
client.otr_priv_key = potr.crypt.PK.parsePrivateKey(priv_key)[0]
|
||||
client.otr_priv_key = potr.crypt.PK.parsePrivateKey(priv_key.decode('hex'))[0]
|
||||
else:
|
||||
client.otr_priv_key = None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue