aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends/test_openssl.py
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2015-04-30 14:06:47 -0400
committerSimo Sorce <simo@redhat.com>2015-10-17 11:58:07 -0400
commit9aaeee0dc62189204f38097c815a0913fabe006c (patch)
tree37621d2d6a20898d9665520a30ecb7a68c0db30e /tests/hazmat/backends/test_openssl.py
parent7a0ed4a7e9443a0506ae5373a8e5cd1ce3539e97 (diff)
downloadcryptography-9aaeee0dc62189204f38097c815a0913fabe006c.tar.gz
cryptography-9aaeee0dc62189204f38097c815a0913fabe006c.tar.bz2
cryptography-9aaeee0dc62189204f38097c815a0913fabe006c.zip
Add an Elliptic Curve Key Exchange Algorithm(ECDH)
The ECDH Key Exchange algorithm as standardized in NIST publication 800-56A Revision 2 Includes tests with vectors from NIST. Signed-off-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'tests/hazmat/backends/test_openssl.py')
-rw-r--r--tests/hazmat/backends/test_openssl.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 8fd0d711..13162046 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -534,6 +534,11 @@ class DummyLibrary(object):
Cryptography_HAS_EC = 0
+class DummyLibraryECDH(object):
+ Cryptography_HAS_EC = 1
+ Cryptography_HAS_ECDH = 0
+
+
class TestOpenSSLEllipticCurve(object):
def test_elliptic_curve_supported(self, monkeypatch):
monkeypatch.setattr(backend, "_lib", DummyLibrary())
@@ -551,6 +556,15 @@ class TestOpenSSLEllipticCurve(object):
with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE):
_sn_to_elliptic_curve(backend, b"fake")
+ def test_elliptic_curve_exchange_algorithm_supported(self, monkeypatch):
+ monkeypatch.setattr(backend, "_lib", DummyLibrary())
+
+ assert backend.elliptic_curve_exchange_algorithm_supported() is False
+
+ monkeypatch.setattr(backend, "_lib", DummyLibraryECDH())
+
+ assert backend.elliptic_curve_exchange_algorithm_supported() is False
+
@pytest.mark.requires_backend_interface(interface=RSABackend)
class TestRSAPEMSerialization(object):