diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-10-19 08:26:27 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-10-19 08:26:27 -0400 |
commit | 7a40209a64c800be1b964a0eded2ab1f40accf50 (patch) | |
tree | 4d8c1fbf39eb98d5c67e63ffb202187a24057e52 /tests | |
parent | aaf4e8bccd9cac827b5f740371feaa7faeebcb93 (diff) | |
download | cryptography-7a40209a64c800be1b964a0eded2ab1f40accf50.tar.gz cryptography-7a40209a64c800be1b964a0eded2ab1f40accf50.tar.bz2 cryptography-7a40209a64c800be1b964a0eded2ab1f40accf50.zip |
better place for this test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 7 | ||||
-rw-r--r-- | tests/hazmat/primitives/test_ec.py | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 3ccc54c8..85331595 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -557,13 +557,6 @@ class TestOpenSSLEllipticCurve(object): ec.ECDH(), ec.SECP256R1() ) - def test_elliptic_curve_exchange_unsupported_algorithm(self): - key = ec.generate_private_key(ec.SECP256R1(), backend=backend) - with raises_unsupported_algorithm( - _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM - ): - key.exchange(None, key.public_key()) - @pytest.mark.requires_backend_interface(interface=RSABackend) class TestRSAPEMSerialization(object): diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index 6c184522..4c4d5b90 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -828,3 +828,19 @@ class TestECDHVectors(object): assert z != vector['Z'] else: assert z == vector['Z'] + + def test_exchange_unsupported_algorithm(self, backend): + _skip_curve_unsupported(backend, ec.SECP256R1()) + + key = load_vectors_from_file( + os.path.join( + "asymmetric", "PKCS8", "ec_private_key.pem"), + lambda pemfile: serialization.load_pem_private_key( + pemfile.read().encode(), None, backend + ) + ) + + with raises_unsupported_algorithm( + exceptions._Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM + ): + key.exchange(None, key.public_key()) |