aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-08-09 10:26:18 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-08-09 10:26:18 -0700
commitb1895f6f786b8be3bbaedf0b17ef1337b71bcfa1 (patch)
treec9f546932328394772ea348b70c6415b6cbdefa0
parent92c1f35054c79f3aef26712ac7ca16480f1847a0 (diff)
downloadcryptography-b1895f6f786b8be3bbaedf0b17ef1337b71bcfa1.tar.gz
cryptography-b1895f6f786b8be3bbaedf0b17ef1337b71bcfa1.tar.bz2
cryptography-b1895f6f786b8be3bbaedf0b17ef1337b71bcfa1.zip
Steps to get this running on py32 and py33 again
-rw-r--r--cryptography/bindings/openssl/api.py4
-rw-r--r--tests/primitives/test_block.py4
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()