diff options
author | drebs <drebs@leap.se> | 2013-06-03 16:19:13 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-06-05 12:21:41 -0300 |
commit | 3462abf72b9057855fe7e1b92b12f04bdbd67537 (patch) | |
tree | da5a6ac0fea9bd8f25b4704773a79ded9fb01113 /src/leap/soledad/backends/leap_backend.py | |
parent | ebca23cd426690453cf5581f32a44121ae1219ce (diff) |
Move symmetric encryption/decryption code from leap.common to leap.soledad.
Diffstat (limited to 'src/leap/soledad/backends/leap_backend.py')
-rw-r--r-- | src/leap/soledad/backends/leap_backend.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/leap/soledad/backends/leap_backend.py b/src/leap/soledad/backends/leap_backend.py index d92025db..18c64f97 100644 --- a/src/leap/soledad/backends/leap_backend.py +++ b/src/leap/soledad/backends/leap_backend.py @@ -33,11 +33,9 @@ from u1db.errors import BrokenSyncStream from u1db.remote.http_target import HTTPSyncTarget -from leap.common.crypto import ( +from leap.soledad.crypto import ( EncryptionMethods, UnknownEncryptionMethod, - encrypt_sym, - decrypt_sym, ) from leap.common.check import leap_assert from leap.soledad.auth import TokenBasedAuth @@ -169,7 +167,7 @@ def encrypt_doc(crypto, doc): """ leap_assert(doc.is_tombstone() is False) # encrypt content using AES-256 CTR mode - iv, ciphertext = encrypt_sym( + iv, ciphertext = crypto.encrypt_sym( doc.get_json(), crypto.doc_passphrase(doc.doc_id), method=EncryptionMethods.AES_256_CTR) @@ -242,7 +240,7 @@ def decrypt_doc(crypto, doc): enc_method = doc.content[ENC_METHOD_KEY] if enc_method == EncryptionMethods.AES_256_CTR: leap_assert(ENC_IV_KEY in doc.content) - plainjson = decrypt_sym( + plainjson = crypto.decrypt_sym( ciphertext, crypto.doc_passphrase(doc.doc_id), method=enc_method, |