Change interface names to fit in the new smaller interface surface and
correct method names on interfaces.
diff --git a/cryptography/hazmat/bindings/interfaces.py b/cryptography/hazmat/bindings/interfaces.py
index 43563d1..ffcd5f1 100644
--- a/cryptography/hazmat/bindings/interfaces.py
+++ b/cryptography/hazmat/bindings/interfaces.py
@@ -18,17 +18,9 @@
import six
-class CiphersProviderBackend(six.with_metaclass(abc.ABCMeta)):
- @abc.abstractproperty
- def ciphers(self):
- """
- An instance of CiphersProvider
- """
-
-
-class CiphersProvider(six.with_metaclass(abc.ABCMeta)):
+class CipherBackend(six.with_metaclass(abc.ABCMeta)):
@abc.abstractmethod
- def supported(self, cipher, mode):
+ def cipher_supported(self, cipher, mode):
"""
"""
@@ -38,76 +30,30 @@
"""
@abc.abstractmethod
- def create_encrypt_ctx(self, cipher, mode):
+ def create_symmetric_encryption_ctx(self, cipher, mode):
"""
"""
@abc.abstractmethod
- def create_decrypt_ctx(self, cipher, mode):
+ def create_symmetric_decryption_ctx(self, cipher, mode):
"""
"""
-class HashesProviderBackend(six.with_metaclass(abc.ABCMeta)):
- @abc.abstractproperty
- def hashes(self):
- """
- An instance of HashesProvider
- """
-
-
-class HashesProvider(six.with_metaclass(abc.ABCMeta)):
+class HashBackend(six.with_metaclass(abc.ABCMeta)):
@abc.abstractmethod
- def supported(self, algorithm):
+ def hash_supported(self, algorithm):
"""
"""
@abc.abstractmethod
- def create_ctx(self, algorithm):
+ def create_hash_ctx(self, algorithm):
"""
"""
+
+class HMACBackend(six.with_metaclass(abc.ABCMeta)):
@abc.abstractmethod
- def update_ctx(self, ctx, data):
- """
- """
-
- @abc.abstractmethod
- def finalize_ctx(self, ctx, digest_size):
- """
- """
-
- @abc.abstractmethod
- def copy_ctx(self, ctx):
- """
- """
-
-
-class HMACsProviderBackend(six.with_metaclass(abc.ABCMeta)):
- @abc.abstractproperty
- def hmacs(self):
- """
- An instance of HMACsProvider
- """
-
-
-class HMACsProvider(six.with_metaclass(abc.ABCMeta)):
- @abc.abstractmethod
- def create_ctx(self, key, algorithm):
- """
- """
-
- @abc.abstractmethod
- def update_ctx(self, ctx, data):
- """
- """
-
- @abc.abstractmethod
- def finalize_ctx(self, ctx, digest_size):
- """
- """
-
- @abc.abstractmethod
- def copy_ctx(self, ctx):
+ def create_hmac_ctx(self, key, algorithm):
"""
"""
diff --git a/cryptography/hazmat/bindings/openssl/backend.py b/cryptography/hazmat/bindings/openssl/backend.py
index a7c0741..db4d18e 100644
--- a/cryptography/hazmat/bindings/openssl/backend.py
+++ b/cryptography/hazmat/bindings/openssl/backend.py
@@ -21,8 +21,7 @@
from cryptography import utils
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.bindings.interfaces import (
- CiphersProviderBackend, CiphersProvider, HashesProviderBackend,
- HashesProvider, HMACsProviderBackend, HMACsProvider
+ CipherBackend, HashBackend, HMACBackend
)
from cryptography.hazmat.primitives import interfaces
from cryptography.hazmat.primitives.ciphers.algorithms import (
@@ -33,9 +32,9 @@
)
-@utils.register_interface(CiphersProviderBackend)
-@utils.register_interface(HashesProviderBackend)
-@utils.register_interface(HMACsProviderBackend)
+@utils.register_interface(CipherBackend)
+@utils.register_interface(HashBackend)
+@utils.register_interface(HMACBackend)
class Backend(object):
"""
OpenSSL API wrapper.
@@ -275,7 +274,7 @@
return self._backend.ffi.buffer(buf)[:outlen[0]]
-@interfaces.register(interfaces.HashContext)
+@utils.register_interface(interfaces.HashContext)
class _HashContext(object):
def __init__(self, backend, algorithm, ctx=None):
self.algorithm = algorithm
@@ -318,7 +317,7 @@
return self._backend.ffi.buffer(buf)[:]
-@interfaces.register(interfaces.HashContext)
+@utils.register_interface(interfaces.HashContext)
class _HMACContext(object):
def __init__(self, backend, key, algorithm, ctx=None):
self.algorithm = algorithm