diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-05-09 09:31:51 -0500 |
|---|---|---|
| committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-05-09 09:31:51 -0500 |
| commit | dbd7a2554435b07d4e4fd8efcb72314b3b4d6962 (patch) | |
| tree | ae4f5a92600a81cabe8d8f53815aa7f57dfe9eae /cryptography | |
| parent | 07287ff1eac2ab5acf6a5f5144704b48da2c820b (diff) | |
| download | cryptography-dbd7a2554435b07d4e4fd8efcb72314b3b4d6962.tar.gz cryptography-dbd7a2554435b07d4e4fd8efcb72314b3b4d6962.tar.bz2 cryptography-dbd7a2554435b07d4e4fd8efcb72314b3b4d6962.zip | |
Multibackend now supports all of RSABackend
Also convert some examples to doctest
Diffstat (limited to 'cryptography')
| -rw-r--r-- | cryptography/hazmat/backends/multibackend.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py index 753f4fc6..c5c652db 100644 --- a/cryptography/hazmat/backends/multibackend.py +++ b/cryptography/hazmat/backends/multibackend.py @@ -146,6 +146,24 @@ class MultiBackend(object): raise UnsupportedAlgorithm("RSA is not supported by the backend", _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) + def mgf1_hash_supported(self, algorithm): + for b in self._filtered_backends(RSABackend): + return b.mgf1_hash_supported(algorithm) + raise UnsupportedAlgorithm("RSA is not supported by the backend", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) + + def decrypt_rsa(self, private_key, ciphertext, padding): + for b in self._filtered_backends(RSABackend): + return b.decrypt_rsa(private_key, ciphertext, padding) + raise UnsupportedAlgorithm("RSA is not supported by the backend", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) + + def encrypt_rsa(self, public_key, plaintext, padding): + for b in self._filtered_backends(RSABackend): + return b.encrypt_rsa(public_key, plaintext, padding) + raise UnsupportedAlgorithm("RSA is not supported by the backend", + _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) + def generate_dsa_parameters(self, key_size): for b in self._filtered_backends(DSABackend): return b.generate_dsa_parameters(key_size) |
