diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-09-08 14:02:48 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-09-08 14:02:48 -0700 |
commit | a54d342197e9714ebdea32411488c147220a66f6 (patch) | |
tree | 6c84ecfef8ff258adcda2964fa622a36a54b91d2 /cryptography | |
parent | 79e51a9b9ce3969c9cc67be655a07cf515dfb1d6 (diff) | |
download | cryptography-a54d342197e9714ebdea32411488c147220a66f6.tar.gz cryptography-a54d342197e9714ebdea32411488c147220a66f6.tar.bz2 cryptography-a54d342197e9714ebdea32411488c147220a66f6.zip |
multibacken for docs
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/hazmat/backends/multibackend.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py index 6893cad6..221f1a1e 100644 --- a/cryptography/hazmat/backends/multibackend.py +++ b/cryptography/hazmat/backends/multibackend.py @@ -17,8 +17,9 @@ from cryptography import utils from cryptography.exceptions import UnsupportedAlgorithm, _Reasons from cryptography.hazmat.backends.interfaces import ( CMACBackend, CipherBackend, DSABackend, EllipticCurveBackend, HMACBackend, - HashBackend, PBKDF2HMACBackend, PKCS8SerializationBackend, - RSABackend, TraditionalOpenSSLSerializationBackend + HashBackend, PBKDF2HMACBackend, PEMSerializationBackend, + PKCS8SerializationBackend, RSABackend, + TraditionalOpenSSLSerializationBackend ) @@ -32,6 +33,7 @@ from cryptography.hazmat.backends.interfaces import ( @utils.register_interface(TraditionalOpenSSLSerializationBackend) @utils.register_interface(DSABackend) @utils.register_interface(EllipticCurveBackend) +@utils.register_interface(PEMSerializationBackend) class MultiBackend(object): name = "multibackend" @@ -318,6 +320,15 @@ class MultiBackend(object): _Reasons.UNSUPPORTED_ELLIPTIC_CURVE ) + def load_pem_private_key(self, data, password): + for b in self._filtered_backends(PEMSerializationBackend): + return b.load_pem_private_key(data, password) + + raise UnsupportedAlgorithm( + "This backend does not support this key serialization.", + _Reasons.UNSUPPORTED_SERIALIZATION + ) + def load_pkcs8_pem_private_key(self, data, password): for b in self._filtered_backends(PKCS8SerializationBackend): return b.load_pkcs8_pem_private_key(data, password) |