Merge "Cache fernet keys when encrypting or decrypting"
This commit is contained in:
commit
753517c419
@ -13,6 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
from functools import lru_cache
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from cryptography import fernet
|
from cryptography import fernet
|
||||||
@ -105,6 +106,7 @@ def decrypt(
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache(maxsize=None)
|
||||||
def _generate_key(passphrase, salt, key_length, iterations):
|
def _generate_key(passphrase, salt, key_length, iterations):
|
||||||
"""
|
"""
|
||||||
Use the passphrase and salt and PBKDF2HMAC key derivation algorithm,
|
Use the passphrase and salt and PBKDF2HMAC key derivation algorithm,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user