aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-07 14:28:16 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-07 14:28:16 -0800
commitdcc3f668c590bd0da898f331b968ed56d46936cf (patch)
treebf5ff9439848eadc5e197aee0ec8c889dcd830be
parent60f1d8b89cf7eb6f4d58eed7be9b816056c1df9c (diff)
downloadcryptography-dcc3f668c590bd0da898f331b968ed56d46936cf.tar.gz
cryptography-dcc3f668c590bd0da898f331b968ed56d46936cf.tar.bz2
cryptography-dcc3f668c590bd0da898f331b968ed56d46936cf.zip
Fixes for the module renaming
-rw-r--r--cryptography/fernet.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/cryptography/fernet.py b/cryptography/fernet.py
index 668958be..2a9f6a96 100644
--- a/cryptography/fernet.py
+++ b/cryptography/fernet.py
@@ -23,7 +23,7 @@ import six
from cryptography.hazmat.primitives import padding, hashes
from cryptography.hazmat.primitives.hmac import HMAC
-from cryptography.hazmat.primitives.block import BlockCipher, ciphers, modes
+from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
class InvalidToken(Exception):
@@ -71,10 +71,10 @@ class Fernet(object):
"Unicode-objects must be encoded before encryption"
)
- padder = padding.PKCS7(ciphers.AES.block_size).padder()
+ padder = padding.PKCS7(algorithms.AES.block_size).padder()
padded_data = padder.update(data) + padder.finalize()
- encryptor = BlockCipher(
- ciphers.AES(self.encryption_key), modes.CBC(iv), self.backend
+ encryptor = Cipher(
+ algorithms.AES(self.encryption_key), modes.CBC(iv), self.backend
).encryptor()
ciphertext = encryptor.update(padded_data) + encryptor.finalize()
@@ -116,11 +116,11 @@ class Fernet(object):
if not lib.constant_time_compare(hmac, len(hmac), data[-32:], 32):
raise InvalidToken
- decryptor = BlockCipher(
- ciphers.AES(self.encryption_key), modes.CBC(iv), self.backend
+ decryptor = Cipher(
+ algorithms.AES(self.encryption_key), modes.CBC(iv), self.backend
).decryptor()
plaintext_padded = decryptor.update(ciphertext) + decryptor.finalize()
- unpadder = padding.PKCS7(ciphers.AES.block_size).unpadder()
+ unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
unpadded = unpadder.update(plaintext_padded)
try: