diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-09-27 13:43:06 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-06 17:31:31 -0500 |
commit | dff22d4707a50b8164c5c6acd5521bcd91160cd1 (patch) | |
tree | 761787ecb9a65b941fcfd4907c16ee244f6bf9b4 /tests/bindings/test_openssl.py | |
parent | 867b979b81aba0578d7241d6a38201214a976ace (diff) | |
download | cryptography-dff22d4707a50b8164c5c6acd5521bcd91160cd1.tar.gz cryptography-dff22d4707a50b8164c5c6acd5521bcd91160cd1.tar.bz2 cryptography-dff22d4707a50b8164c5c6acd5521bcd91160cd1.zip |
Camellia block cipher support
* Tests for CBC, OFB, CFB, and ECB
* Tests will be automatically skipped if camellia support is not present
in your OpenSSL library (e.g. OS X 10.8 with default OpenSSL)
* Test for unsupported cipher in create_block_cipher_context
* Docs for the cipher
Diffstat (limited to 'tests/bindings/test_openssl.py')
-rw-r--r-- | tests/bindings/test_openssl.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/bindings/test_openssl.py b/tests/bindings/test_openssl.py index b23c4ccc..85ecc49c 100644 --- a/tests/bindings/test_openssl.py +++ b/tests/bindings/test_openssl.py @@ -11,6 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import pytest + from cryptography.bindings.openssl.api import api @@ -28,3 +30,19 @@ class TestOpenSSL(object): for every OpenSSL. """ assert api.openssl_version_text().startswith("OpenSSL") + + def test_supports(self): + assert api.supports("not-a-real-cipher") is False + + def test_create_block_cipher_context_with_unsupported_cipher(self): + class FakeCipher(object): + name = "FakeCipher" + key_size = 24 + + class FakeMode(object): + name = "CCC" + + with pytest.raises(AssertionError): + cipher = FakeCipher() + mode = FakeMode() + api.create_block_cipher_context(cipher, mode) |