diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-07-08 00:00:55 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-07-08 00:00:55 -0700 |
commit | 02f5caa833bf01e537f0bff94c3a71a675d234c4 (patch) | |
tree | f48b5ed4ce61b272bae4d7cba0884702c67387e7 /tests/hazmat/backends | |
parent | 7f68ccda2080c427f5e34b4ecc16cba9a030f2c6 (diff) | |
parent | 5a3e0754f94a280783e0d5b9c1082097566fa62f (diff) | |
download | cryptography-02f5caa833bf01e537f0bff94c3a71a675d234c4.tar.gz cryptography-02f5caa833bf01e537f0bff94c3a71a675d234c4.tar.bz2 cryptography-02f5caa833bf01e537f0bff94c3a71a675d234c4.zip |
Merge branch 'master' into deprecation
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r-- | tests/hazmat/backends/test_multibackend.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index a68fe560..3be8371f 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -19,7 +19,7 @@ from cryptography.exceptions import ( ) from cryptography.hazmat.backends.interfaces import ( CMACBackend, CipherBackend, DSABackend, EllipticCurveBackend, HMACBackend, - HashBackend, PBKDF2HMACBackend, RSABackend + HashBackend, PBKDF2HMACBackend, PKCS8SerializationBackend, RSABackend ) from cryptography.hazmat.backends.multibackend import MultiBackend from cryptography.hazmat.primitives import cmac, hashes, hmac @@ -192,6 +192,12 @@ class DummyEllipticCurveBackend(object): raise UnsupportedAlgorithm(_Reasons.UNSUPPORTED_ELLIPTIC_CURVE) +@utils.register_interface(PKCS8SerializationBackend) +class DummyPKCS8SerializationBackend(object): + def load_pkcs8_pem_private_key(self, data, password): + pass + + class TestMultiBackend(object): def test_ciphers(self): backend = MultiBackend([ @@ -471,3 +477,12 @@ class TestMultiBackend(object): 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) |