diff --git a/src/plugins/plugin_sec_otr.py b/src/plugins/plugin_sec_otr.py index 99991b19..c83034f4 100644 --- a/src/plugins/plugin_sec_otr.py +++ b/src/plugins/plugin_sec_otr.py @@ -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