aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2019-02-21 12:53:45 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2019-02-20 23:53:45 -0500
commite1f7e0978231f73382f95b864200fdeca7d37bb7 (patch)
treeea0c6c6362b62bf634922b94113e37a43f2fdfd9 /tests/hazmat
parent5cfaa5b79d446e1c63de3948e7558cd00561ea1f (diff)
downloadcryptography-e1f7e0978231f73382f95b864200fdeca7d37bb7.tar.gz
cryptography-e1f7e0978231f73382f95b864200fdeca7d37bb7.tar.bz2
cryptography-e1f7e0978231f73382f95b864200fdeca7d37bb7.zip
add an EC OID to curve dictionary mapping (#4759)
* add an EC OID to curve dictionary mapping * oid_to_curve function * changelog and docs fix * rename to get_curve_for_oid
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/primitives/test_ec.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py
index 1f3a67d3..cd30223c 100644
--- a/tests/hazmat/primitives/test_ec.py
+++ b/tests/hazmat/primitives/test_ec.py
@@ -11,7 +11,7 @@ from binascii import hexlify
import pytest
-from cryptography import exceptions, utils
+from cryptography import exceptions, utils, x509
from cryptography.hazmat.backends.interfaces import (
EllipticCurveBackend, PEMSerializationBackend
)
@@ -71,6 +71,12 @@ def _skip_exchange_algorithm_unsupported(backend, algorithm, curve):
)
+def test_get_curve_for_oid():
+ assert ec.get_curve_for_oid(ec.EllipticCurveOID.SECP256R1) == ec.SECP256R1
+ with pytest.raises(LookupError):
+ ec.get_curve_for_oid(x509.ObjectIdentifier("1.1.1.1"))
+
+
@utils.register_interface(ec.EllipticCurve)
class DummyCurve(object):
name = "dummy-curve"