diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-05 20:35:14 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:32 +0200 |
commit | b4b5a6d10d71208fa5ae2b2ef6e61845d63c5047 (patch) | |
tree | b26540f4995eef860004b8f03c56ca42e5a53028 /service/pixelated/support | |
parent | f29447b4fbed2328f976fdfacd554f051e40b8db (diff) |
Removed XSALSA20 dependency.
- Use crypto algorithm prefered by soledad instead
Diffstat (limited to 'service/pixelated/support')
-rw-r--r-- | service/pixelated/support/encrypted_file_storage.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/service/pixelated/support/encrypted_file_storage.py b/service/pixelated/support/encrypted_file_storage.py index 3f3e47d6..567a348a 100644 --- a/service/pixelated/support/encrypted_file_storage.py +++ b/service/pixelated/support/encrypted_file_storage.py @@ -56,16 +56,16 @@ class EncryptedFileStorage(FileStorage): return hmac.new(self.signkey, verifiable_payload, sha256).digest() def encrypt(self, content): - iv, ciphertext = encrypt_sym(content, self.masterkey, EncryptionMethods.XSALSA20) + iv, ciphertext = encrypt_sym(content, self.masterkey) mac = self.gen_mac(iv, ciphertext) return ''.join((mac, iv, ciphertext)) def decrypt(self, payload): - payload_mac, iv, ciphertext = payload[:32], payload[32:65], payload[65:] + payload_mac, iv, ciphertext = payload[:32], payload[32:57], payload[57:] generated_mac = self.gen_mac(iv, ciphertext) if sha256(payload_mac).digest() != sha256(generated_mac).digest(): raise Exception("EncryptedFileStorage - Error opening file. Wrong MAC") - return decrypt_sym(ciphertext, self.masterkey, EncryptionMethods.XSALSA20, iv=iv) + return decrypt_sym(ciphertext, self.masterkey, iv) def _encrypt_index_on_close(self, name): def wrapper(struct_file): |