diff options
| -rw-r--r-- | cryptography/hazmat/backends/multibackend.py | 45 | ||||
| -rw-r--r-- | tests/hazmat/backends/test_multibackend.py | 75 | 
2 files changed, 0 insertions, 120 deletions
| diff --git a/cryptography/hazmat/backends/multibackend.py b/cryptography/hazmat/backends/multibackend.py index ce9e6dee..db189787 100644 --- a/cryptography/hazmat/backends/multibackend.py +++ b/cryptography/hazmat/backends/multibackend.py @@ -148,38 +148,6 @@ class MultiBackend(object):          raise UnsupportedAlgorithm("RSA is not supported by the backend.",                                     _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) -    def create_rsa_signature_ctx(self, private_key, padding, algorithm): -        for b in self._filtered_backends(RSABackend): -            return b.create_rsa_signature_ctx(private_key, padding, algorithm) -        raise UnsupportedAlgorithm("RSA is not supported by the backend.", -                                   _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) - -    def create_rsa_verification_ctx(self, public_key, signature, padding, -                                    algorithm): -        for b in self._filtered_backends(RSABackend): -            return b.create_rsa_verification_ctx(public_key, signature, -                                                 padding, algorithm) -        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 rsa_padding_supported(self, padding):          for b in self._filtered_backends(RSABackend):              return b.rsa_padding_supported(padding) @@ -218,19 +186,6 @@ class MultiBackend(object):          raise UnsupportedAlgorithm("DSA is not supported by the backend.",                                     _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) -    def create_dsa_verification_ctx(self, public_key, signature, algorithm): -        for b in self._filtered_backends(DSABackend): -            return b.create_dsa_verification_ctx(public_key, signature, -                                                 algorithm) -        raise UnsupportedAlgorithm("DSA is not supported by the backend.", -                                   _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) - -    def create_dsa_signature_ctx(self, private_key, algorithm): -        for b in self._filtered_backends(DSABackend): -            return b.create_dsa_signature_ctx(private_key, algorithm) -        raise UnsupportedAlgorithm("DSA is not supported by the backend.", -                                   _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM) -      def dsa_hash_supported(self, algorithm):          for b in self._filtered_backends(DSABackend):              return b.dsa_hash_supported(algorithm) diff --git a/tests/hazmat/backends/test_multibackend.py b/tests/hazmat/backends/test_multibackend.py index 61bda54c..93934ad6 100644 --- a/tests/hazmat/backends/test_multibackend.py +++ b/tests/hazmat/backends/test_multibackend.py @@ -95,28 +95,12 @@ class DummyRSABackend(object):      def generate_rsa_private_key(self, public_exponent, private_key):          pass -    def create_rsa_signature_ctx(self, private_key, padding, algorithm): -        pass - -    def create_rsa_verification_ctx(self, public_key, signature, padding, -                                    algorithm): -        pass - -    def mgf1_hash_supported(self, algorithm): -        pass -      def rsa_padding_supported(self, padding):          pass      def generate_rsa_parameters_supported(self, public_exponent, key_size):          pass -    def decrypt_rsa(self, private_key, ciphertext, padding): -        pass - -    def encrypt_rsa(self, public_key, plaintext, padding): -        pass -      def load_rsa_private_numbers(self, numbers):          pass @@ -135,12 +119,6 @@ class DummyDSABackend(object):      def generate_dsa_private_key_and_parameters(self, key_size):          pass -    def create_dsa_signature_ctx(self, private_key, algorithm): -        pass - -    def create_dsa_verification_ctx(self, public_key, signature, algorithm): -        pass -      def dsa_hash_supported(self, algorithm):          pass @@ -303,22 +281,10 @@ class TestMultiBackend(object):              key_size=1024, public_exponent=65537          ) -        backend.create_rsa_signature_ctx("private_key", padding.PKCS1v15(), -                                         hashes.MD5()) - -        backend.create_rsa_verification_ctx("public_key", "sig", -                                            padding.PKCS1v15(), hashes.MD5()) - -        backend.mgf1_hash_supported(hashes.MD5()) -          backend.rsa_padding_supported(padding.PKCS1v15())          backend.generate_rsa_parameters_supported(65537, 1024) -        backend.encrypt_rsa("public_key", "encryptme", padding.PKCS1v15()) - -        backend.decrypt_rsa("private_key", "encrypted", padding.PKCS1v15()) -          backend.load_rsa_private_numbers("private_numbers")          backend.load_rsa_public_numbers("public_numbers") @@ -332,23 +298,6 @@ class TestMultiBackend(object):          with raises_unsupported_algorithm(              _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM          ): -            backend.create_rsa_signature_ctx("private_key", padding.PKCS1v15(), -                                             hashes.MD5()) - -        with raises_unsupported_algorithm( -            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM -        ): -            backend.create_rsa_verification_ctx( -                "public_key", "sig", padding.PKCS1v15(), hashes.MD5()) - -        with raises_unsupported_algorithm( -            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM -        ): -            backend.mgf1_hash_supported(hashes.MD5()) - -        with raises_unsupported_algorithm( -            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM -        ):              backend.rsa_padding_supported(padding.PKCS1v15())          with raises_unsupported_algorithm( @@ -359,16 +308,6 @@ class TestMultiBackend(object):          with raises_unsupported_algorithm(              _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM          ): -            backend.encrypt_rsa("public_key", "encryptme", padding.PKCS1v15()) - -        with raises_unsupported_algorithm( -            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM -        ): -            backend.decrypt_rsa("private_key", "encrypted", padding.PKCS1v15()) - -        with raises_unsupported_algorithm( -            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM -        ):              backend.load_rsa_private_numbers("private_numbers")          with raises_unsupported_algorithm( @@ -387,8 +326,6 @@ class TestMultiBackend(object):          backend.generate_dsa_private_key(parameters)          backend.generate_dsa_private_key_and_parameters(key_size=1024) -        backend.create_dsa_verification_ctx("public_key", "sig", hashes.SHA1()) -        backend.create_dsa_signature_ctx("private_key", hashes.SHA1())          backend.dsa_hash_supported(hashes.SHA1())          backend.dsa_parameters_supported(1, 2, 3)          backend.load_dsa_private_numbers("numbers") @@ -413,18 +350,6 @@ class TestMultiBackend(object):          with raises_unsupported_algorithm(              _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM          ): -            backend.create_dsa_signature_ctx("private_key", hashes.SHA1()) - -        with raises_unsupported_algorithm( -            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM -        ): -            backend.create_dsa_verification_ctx( -                "public_key", b"sig", hashes.SHA1() -            ) - -        with raises_unsupported_algorithm( -            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM -        ):              backend.dsa_hash_supported(hashes.SHA1())          with raises_unsupported_algorithm( | 
