summaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2016-03-09 12:50:08 -0400
committerKali Kaneko <kali@leap.se>2016-03-09 16:14:00 -0400
commit45da47b7b5cddfe40820a8589d82527c2629adae (patch)
tree2f426c6a336fffb3e6a1c33c80b8ea276989d77f /client/src
parent8bf307437e0ef469bf2a5d58982a29b3c32354e2 (diff)
[bug] specify openssl backend explicitely
for some reason, available_backends does not work inside a frozen PyInstaller binary. - Resolves: #7952
Diffstat (limited to 'client/src')
-rw-r--r--client/src/leap/soledad/client/crypto.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/leap/soledad/client/crypto.py b/client/src/leap/soledad/client/crypto.py
index 07a3eaab..363d71b9 100644
--- a/client/src/leap/soledad/client/crypto.py
+++ b/client/src/leap/soledad/client/crypto.py
@@ -25,7 +25,8 @@ import json
import logging
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
-from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.backends.multibackend import MultiBackend
+from cryptography.hazmat.backends.openssl.backend import Backend as OpenSSLBackend
from leap.soledad.common import soledad_assert
from leap.soledad.common import soledad_assert_type
@@ -57,7 +58,7 @@ def encrypt_sym(data, key):
(len(key) * 8))
iv = os.urandom(16)
- backend = default_backend()
+ backend = MultiBackend([OpenSSLBackend()])
cipher = Cipher(algorithms.AES(key), modes.CTR(iv), backend=backend)
encryptor = cipher.encryptor()
ciphertext = encryptor.update(data) + encryptor.finalize()
@@ -85,7 +86,7 @@ def decrypt_sym(data, key, iv):
soledad_assert(
len(key) == 32, # 32 x 8 = 256 bits.
'Wrong key size: %s (must be 256 bits long).' % len(key))
- backend = default_backend()
+ backend = MultiBackend([OpenSSLBackend()])
iv = binascii.a2b_base64(iv)
cipher = Cipher(algorithms.AES(key), modes.CTR(iv), backend=backend)
decryptor = cipher.decryptor()