aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-12-18 13:46:51 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-12-18 13:46:51 -0600
commit60657bbd2907e5116fac176079a3da31b2c56d3c (patch)
treea8954344e2ede283fe6433e6b93b5773dfe2a09b /tests/hazmat
parent9cde70ae840685f2bae6173b6beb192ae3866dc3 (diff)
downloadcryptography-60657bbd2907e5116fac176079a3da31b2c56d3c.tar.gz
cryptography-60657bbd2907e5116fac176079a3da31b2c56d3c.tar.bz2
cryptography-60657bbd2907e5116fac176079a3da31b2c56d3c.zip
remove fully deprecated items from 0.6 deprecation cycle
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/backends/test_multibackend.py88
-rw-r--r--tests/hazmat/backends/test_openssl.py44
2 files changed, 3 insertions, 129 deletions
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py
index 03aa3cd8..43ecbf83 100644
--- a/tests/hazmat/backends/test_multibackend.py
+++ b/tests/hazmat/backends/test_multibackend.py
@@ -4,8 +4,6 @@
from __future__ import absolute_import, division, print_function
-import pytest
-
from cryptography import utils
from cryptography.exceptions import (
UnsupportedAlgorithm, _Reasons
@@ -13,8 +11,7 @@ from cryptography.exceptions import (
from cryptography.hazmat.backends.interfaces import (
CMACBackend, CipherBackend, DSABackend, EllipticCurveBackend, HMACBackend,
HashBackend, PBKDF2HMACBackend, PEMSerializationBackend,
- PKCS8SerializationBackend, RSABackend,
- TraditionalOpenSSLSerializationBackend, X509Backend
+ RSABackend, X509Backend
)
from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.primitives import cmac, hashes, hmac
@@ -169,31 +166,11 @@ class DummyEllipticCurveBackend(object):
if not self.elliptic_curve_supported(numbers.public_numbers.curve):
raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE)
- def elliptic_curve_private_key_from_numbers(self, numbers):
- if not self.elliptic_curve_supported(numbers.public_numbers.curve):
- raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE)
-
- def elliptic_curve_public_key_from_numbers(self, numbers):
- if not self.elliptic_curve_supported(numbers.curve):
- raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE)
-
def load_elliptic_curve_public_numbers(self, numbers):
if not self.elliptic_curve_supported(numbers.curve):
raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE)
-@utils.register_interface(PKCS8SerializationBackend)
-class DummyPKCS8SerializationBackend(object):
- def load_pkcs8_pem_private_key(self, data, password):
- pass
-
-
-@utils.register_interface(TraditionalOpenSSLSerializationBackend)
-class DummyTraditionalOpenSSLSerializationBackend(object):
- def load_traditional_openssl_pem_private_key(self, data, password):
- pass
-
-
@utils.register_interface(PEMSerializationBackend)
class DummyPEMSerializationBackend(object):
def load_pem_private_key(self, data, password):
@@ -457,69 +434,6 @@ class TestMultiBackend(object):
)
)
- def test_deprecated_elliptic_curve(self):
- backend = MultiBackend([
- DummyEllipticCurveBackend([
- ec.SECT283K1
- ])
- ])
-
- assert backend.elliptic_curve_signature_algorithm_supported(
- ec.ECDSA(hashes.SHA256()),
- ec.SECT163K1()
- ) is False
-
- pub_numbers = ec.EllipticCurvePublicNumbers(2, 3, ec.SECT283K1())
- numbers = ec.EllipticCurvePrivateNumbers(1, pub_numbers)
-
- pytest.deprecated_call(
- backend.elliptic_curve_private_key_from_numbers,
- numbers
- )
- pytest.deprecated_call(
- backend.elliptic_curve_public_key_from_numbers,
- pub_numbers
- )
-
- with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE):
- backend.elliptic_curve_private_key_from_numbers(
- ec.EllipticCurvePrivateNumbers(
- 1,
- ec.EllipticCurvePublicNumbers(
- 2,
- 3,
- ec.SECT163K1()
- )
- )
- )
-
- with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE):
- backend.elliptic_curve_public_key_from_numbers(
- ec.EllipticCurvePublicNumbers(
- 2,
- 3,
- ec.SECT163K1()
- )
- )
-
- def test_pkcs8_serialization_backend(self):
- backend = MultiBackend([DummyPKCS8SerializationBackend()])
-
- backend.load_pkcs8_pem_private_key(b"keydata", None)
-
- backend = MultiBackend([])
- with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_SERIALIZATION):
- backend.load_pkcs8_pem_private_key(b"keydata", None)
-
- def test_traditional_openssl_serialization_backend(self):
- backend = MultiBackend([DummyTraditionalOpenSSLSerializationBackend()])
-
- backend.load_traditional_openssl_pem_private_key(b"keydata", None)
-
- backend = MultiBackend([])
- with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_SERIALIZATION):
- backend.load_traditional_openssl_pem_private_key(b"keydata", None)
-
def test_pem_serialization_backend(self):
backend = MultiBackend([DummyPEMSerializationBackend()])
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index dfd0abe1..b6bb5491 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -15,20 +15,18 @@ import pytest
from cryptography import utils
from cryptography.exceptions import InternalError, _Reasons
-from cryptography.hazmat.backends.interfaces import EllipticCurveBackend
from cryptography.hazmat.backends.openssl.backend import (
Backend, backend
)
from cryptography.hazmat.backends.openssl.ec import _sn_to_elliptic_curve
from cryptography.hazmat.primitives import hashes, interfaces
-from cryptography.hazmat.primitives.asymmetric import dsa, ec, padding
+from cryptography.hazmat.primitives.asymmetric import dsa, padding
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.fixtures_rsa import RSA_KEY_512
-from ..primitives.test_ec import _skip_curve_unsupported
from ...utils import load_vectors_from_file, raises_unsupported_algorithm
@@ -458,7 +456,7 @@ class TestOpenSSLSerialisationWithOpenSSL(object):
"key1.pem"
),
lambda pemfile: (
- backend.load_traditional_openssl_pem_private_key(
+ backend.load_pem_private_key(
pemfile.read().encode(), password
)
)
@@ -481,41 +479,3 @@ class TestOpenSSLEllipticCurve(object):
def test_sn_to_elliptic_curve_not_supported(self):
with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE):
_sn_to_elliptic_curve(backend, b"fake")
-
-
-@pytest.mark.requires_backend_interface(interface=EllipticCurveBackend)
-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
- )