memory: add helper methods encryptValue and decryptValue
This commit is contained in:
parent
83ed5f319c
commit
94d36a7d3e
1 changed files with 31 additions and 5 deletions
|
|
@ -385,11 +385,7 @@ class Params(object):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue