diff src/memory/params.py @ 1090:594fbdda4a87

memory: add helper methods encryptValue and decryptValue
author souliane <souliane@mailoo.org>
date Wed, 25 Jun 2014 19:01:00 +0200
parents b29452cab50b
children f91e7028e2c3
line wrap: on
line diff
--- a/src/memory/params.py	Mon Jun 23 10:23:13 2014 +0200
+++ b/src/memory/params.py	Wed Jun 25 19:01:00 2014 +0200
@@ -385,11 +385,7 @@
             return defer.succeed(value)  # profile password and empty passwords are returned "as is"
         if not profile:
             raise exceptions.ProfileUnknownError('The profile is needed to decrypt a password')
-        try:
-            personal_key = self.host.memory.auth_sessions.profileGetUnique(profile)[C.MEMORY_CRYPTO_KEY]
-        except TypeError:
-            raise exceptions.InternalError(_('Trying to decrypt a password while the personal key is undefined!'))
-        d = BlockCipher.decrypt(personal_key, value)
+        d = self.host.memory.decryptValue(value, profile)
 
         def gotPlainPassword(password):
             if password is None:  # empty value means empty password, None means decryption failure