aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends/test_openssl.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-09-27 11:59:56 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2014-09-27 11:59:56 -0400
commite9022fee01112d00d97ebc499a48f5d71fb83af7 (patch)
tree8645894150322408d44d200c6e303fa20e868f99 /tests/hazmat/backends/test_openssl.py
parent45d4c5909bd857986b901d59fd4d77bce63bfeff (diff)
parentcff58d8d28ad15a8f7abaaa6ff5320a7d1f5b2f9 (diff)
downloadcryptography-e9022fee01112d00d97ebc499a48f5d71fb83af7.tar.gz
cryptography-e9022fee01112d00d97ebc499a48f5d71fb83af7.tar.bz2
cryptography-e9022fee01112d00d97ebc499a48f5d71fb83af7.zip
Merge pull request #1348 from reaperhulk/improve-naming-consistency
deprecate backend method names for elliptic curve number loading
Diffstat (limited to 'tests/hazmat/backends/test_openssl.py')
-rw-r--r--tests/hazmat/backends/test_openssl.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 110bbdba..bfe6040e 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -28,12 +28,13 @@ from cryptography.hazmat.backends.openssl.backend import (
Backend, backend
)
from cryptography.hazmat.primitives import hashes, interfaces
-from cryptography.hazmat.primitives.asymmetric import dsa, padding, rsa
+from cryptography.hazmat.primitives.asymmetric import dsa, ec, padding, rsa
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import CBC, CTR
from cryptography.hazmat.primitives.interfaces import BlockCipherAlgorithm
+from ..primitives.test_ec import _skip_curve_unsupported
from ...utils import load_vectors_from_file, raises_unsupported_algorithm
@@ -569,3 +570,41 @@ class TestDeprecatedDSABackendMethods(object):
b"\x00" * 128,
hashes.SHA1()
)
+
+
+@pytest.mark.elliptic
+class TestDeprecatedECBackendMethods(object):
+ def test_elliptic_curve_private_key_from_numbers(self):
+ d = 5634846038258869671139984276180670841223409490498798721258
+ y = 4131560123026307384858369684985976479488628761329758810693
+ x = 3402090428547195623222463880060959356423657484435591627791
+ curve = ec.SECP192R1()
+ _skip_curve_unsupported(backend, curve)
+ pub_numbers = ec.EllipticCurvePublicNumbers(
+ x=x,
+ y=y,
+ curve=curve
+ )
+ numbers = ec.EllipticCurvePrivateNumbers(
+ private_value=d,
+ public_numbers=pub_numbers
+ )
+ pytest.deprecated_call(
+ backend.elliptic_curve_private_key_from_numbers,
+ numbers
+ )
+
+ def test_elliptic_curve_public_key_from_numbers(self):
+ y = 4131560123026307384858369684985976479488628761329758810693
+ x = 3402090428547195623222463880060959356423657484435591627791
+ curve = ec.SECP192R1()
+ _skip_curve_unsupported(backend, curve)
+ pub_numbers = ec.EllipticCurvePublicNumbers(
+ x=x,
+ y=y,
+ curve=curve
+ )
+ pytest.deprecated_call(
+ backend.elliptic_curve_public_key_from_numbers,
+ pub_numbers
+ )