aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends/test_multibackend.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/backends/test_multibackend.py')
-rw-r--r--tests/hazmat/backends/test_multibackend.py88
1 files changed, 1 insertions, 87 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()])