|
@@ -193,7 +193,7 @@ class CryptoEngine(object): # pagma: no cover
|
|
"""
|
|
"""
|
|
salt = base64.b64encode(os.urandom(32))
|
|
salt = base64.b64encode(os.urandom(32))
|
|
passwd = reader("Please type in the secret key:")
|
|
passwd = reader("Please type in the secret key:")
|
|
- key = get_digest(passwd, salt)
|
|
|
|
|
|
+ key = self._get_digest(passwd, salt)
|
|
hpk = salt+'$6$'.encode('utf8')+binascii.hexlify(key)
|
|
hpk = salt+'$6$'.encode('utf8')+binascii.hexlify(key)
|
|
return hpk.decode('utf-8')
|
|
return hpk.decode('utf-8')
|
|
|
|
|
|
@@ -201,6 +201,13 @@ class CryptoEngine(object): # pagma: no cover
|
|
self._keycrypted = self._create_password(reader=reader)
|
|
self._keycrypted = self._create_password(reader=reader)
|
|
return self._keycrypted
|
|
return self._keycrypted
|
|
|
|
|
|
|
|
+ def _get_digest(self, password, salt):
|
|
|
|
+ """
|
|
|
|
+ Get a digest based on clear text password
|
|
|
|
+ """
|
|
|
|
+ iterations = 5000
|
|
|
|
+ return PBKDF2(password, salt, dkLen=32, count=iterations)
|
|
|
|
+
|
|
def __init__(self, keycrypted=None, algorithm='AES', timeout=-1):
|
|
def __init__(self, keycrypted=None, algorithm='AES', timeout=-1):
|
|
"""
|
|
"""
|
|
Initialise the Cryptographic Engine
|
|
Initialise the Cryptographic Engine
|