pep8 and py3k fixes
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py
index ced2cf8..d5a319c 100644
--- a/cryptography/bindings/openssl/api.py
+++ b/cryptography/bindings/openssl/api.py
@@ -29,7 +29,7 @@
def __call__(self, api, cipher, mode):
cipher_name = self._fmt.format(cipher=cipher, mode=mode).lower()
- return api.lib.EVP_get_cipherbyname(cipher_name)
+ return api.lib.EVP_get_cipherbyname(cipher_name.encode("ascii"))
class API(object):
diff --git a/tests/primitives/test_cryptrec.py b/tests/primitives/test_cryptrec.py
index 56eca3a..02a0447 100644
--- a/tests/primitives/test_cryptrec.py
+++ b/tests/primitives/test_cryptrec.py
@@ -37,6 +37,8 @@
],
lambda key: ciphers.Camellia(binascii.unhexlify((key))),
lambda key: modes.ECB(),
- only_if=lambda api: api.supports_cipher(ciphers.Camellia("\x00" * 16), modes.ECB()),
+ only_if=lambda api: api.supports_cipher(
+ ciphers.Camellia("\x00" * 16), modes.ECB()
+ ),
skip_message="Does not support Camellia ECB",
)
diff --git a/tests/primitives/test_openssl_vectors.py b/tests/primitives/test_openssl_vectors.py
index f53ade8..bcbda86 100644
--- a/tests/primitives/test_openssl_vectors.py
+++ b/tests/primitives/test_openssl_vectors.py
@@ -32,7 +32,9 @@
["camellia-cbc.txt"],
lambda key, iv: ciphers.Camellia(binascii.unhexlify(key)),
lambda key, iv: modes.CBC(binascii.unhexlify(iv)),
- only_if=lambda api: api.supports_cipher(ciphers.Camellia("\x00" * 16), modes.CBC("\x00" * 16)),
+ only_if=lambda api: api.supports_cipher(
+ ciphers.Camellia("\x00" * 16), modes.CBC("\x00" * 16)
+ ),
skip_message="Does not support Camellia CBC",
)
@@ -44,7 +46,9 @@
["camellia-ofb.txt"],
lambda key, iv: ciphers.Camellia(binascii.unhexlify(key)),
lambda key, iv: modes.OFB(binascii.unhexlify(iv)),
- only_if=lambda api: api.supports_cipher(ciphers.Camellia("\x00" * 16), modes.OFB("\x00" * 16)),
+ only_if=lambda api: api.supports_cipher(
+ ciphers.Camellia("\x00" * 16), modes.OFB("\x00" * 16)
+ ),
skip_message="Does not support Camellia OFB",
)
@@ -56,6 +60,8 @@
["camellia-cfb.txt"],
lambda key, iv: ciphers.Camellia(binascii.unhexlify(key)),
lambda key, iv: modes.CFB(binascii.unhexlify(iv)),
- only_if=lambda api: api.supports_cipher(ciphers.Camellia("\x00" * 16), modes.CFB("\x00" * 16)),
+ only_if=lambda api: api.supports_cipher(
+ ciphers.Camellia("\x00" * 16), modes.CFB("\x00" * 16)
+ ),
skip_message="Does not support Camellia CFB",
)