aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-04-15 18:16:27 +0800
committerAyrx <terrycwk1994@gmail.com>2014-04-15 18:16:27 +0800
commit15b6ede389f7abc7064a65b88c864fa8a2aca816 (patch)
tree476faff127d9e732d04fc6497f1c416316e0cbc4
parentc8368609f018370758a359fca7857bcc421203e6 (diff)
downloadcryptography-15b6ede389f7abc7064a65b88c864fa8a2aca816.tar.gz
cryptography-15b6ede389f7abc7064a65b88c864fa8a2aca816.tar.bz2
cryptography-15b6ede389f7abc7064a65b88c864fa8a2aca816.zip
Added CMAC backend interface
-rw-r--r--cryptography/hazmat/backends/interfaces.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/cryptography/hazmat/backends/interfaces.py b/cryptography/hazmat/backends/interfaces.py
index e4c1df34..9539d839 100644
--- a/cryptography/hazmat/backends/interfaces.py
+++ b/cryptography/hazmat/backends/interfaces.py
@@ -142,3 +142,18 @@ class OpenSSLSerializationBackend(object):
Load a private key from PEM encoded data, using password if the data
is encrypted.
"""
+
+
+@six.add_metaclass(abc.ABCMeta)
+class CMACBackend(object):
+ @abc.abstractmethod
+ def cmac_supported(self):
+ """
+ Returns True if the backend supports CMAC
+ """
+
+ @abc.abstractmethod
+ def create_cmac_ctx(self, key, algorithm):
+ """
+ Create a CMACContext for calculating a message authentication code.
+ """