diff options
-rw-r--r-- | cryptography/bindings/openssl/api.py | 4 | ||||
-rw-r--r-- | tests/primitives/test_block.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 24679966..7594fba6 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -61,8 +61,8 @@ class API(object): def create_block_cipher_context(self, cipher, mode): ctx = self._ffi.new("EVP_CIPHER_CTX *") # TODO: compute name using a better algorithm - ciphername = b"{}-{}-{}".format(cipher.name, len(cipher.key) * 8, mode.name) - evp_cipher = self._lib.EVP_get_cipherbyname(ciphername) + ciphername = "{0}-{1}-{2}".format(cipher.name, len(cipher.key) * 8, mode.name) + evp_cipher = self._lib.EVP_get_cipherbyname(ciphername.encode("ascii")) if evp_cipher == self._ffi.NULL: raise OpenSSLError(self) # TODO: only use the key and initialization_vector as needed. Sometimes diff --git a/tests/primitives/test_block.py b/tests/primitives/test_block.py index f2da5830..8c311d5c 100644 --- a/tests/primitives/test_block.py +++ b/tests/primitives/test_block.py @@ -13,8 +13,8 @@ class TestBlockCipher(object): ) def test_aes_cbc_nopadding(self, key, iv, plaintext, ciphertext): cipher = BlockCipher( - ciphers.AES(binascii.unhexlify(key)), - modes.CBC(binascii.unhexlify(iv), padding.NoPadding()) + ciphers.AES(binascii.unhexlify(key.encode("ascii"))), + modes.CBC(binascii.unhexlify(iv.encode("ascii")), padding.NoPadding()) ) actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext)) actual_ciphertext += cipher.finalize() |