aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-05-29 10:13:35 -0500
committerAlex Gaynor <alex.gaynor@gmail.com>2017-05-29 11:13:35 -0400
commit7bc36865fcdb1057a4d2925d28f688c5590d6eaf (patch)
treeac7fec3f87e1e786625c4d1196549c10573859ce /src
parentf99d45e30b59771b5d675e91362b7d64dd367a4a (diff)
downloadcryptography-7bc36865fcdb1057a4d2925d28f688c5590d6eaf.tar.gz
cryptography-7bc36865fcdb1057a4d2925d28f688c5590d6eaf.tar.bz2
cryptography-7bc36865fcdb1057a4d2925d28f688c5590d6eaf.zip
move MACContext to mac.py and eliminate interfaces.py (#3631)
* move MACContext to mac.py and eliminate interfaces.py finally * improve title * re-add and deprecate interfaces.MACContext * use pytest.warns instead of deprecated_call The pytest docs insist that deprecation warnings are handled differently and that you should use deprecated_call, but this works so okay then
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/cmac.py4
-rw-r--r--src/cryptography/hazmat/backends/openssl/hmac.py4
-rw-r--r--src/cryptography/hazmat/primitives/cmac.py4
-rw-r--r--src/cryptography/hazmat/primitives/hmac.py4
-rw-r--r--src/cryptography/hazmat/primitives/interfaces.py17
-rw-r--r--src/cryptography/hazmat/primitives/mac.py (renamed from src/cryptography/hazmat/primitives/interfaces/__init__.py)0
6 files changed, 25 insertions, 8 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/cmac.py b/src/cryptography/hazmat/backends/openssl/cmac.py
index eaefc276..5919017a 100644
--- a/src/cryptography/hazmat/backends/openssl/cmac.py
+++ b/src/cryptography/hazmat/backends/openssl/cmac.py
@@ -9,11 +9,11 @@ from cryptography import utils
from cryptography.exceptions import (
InvalidSignature, UnsupportedAlgorithm, _Reasons
)
-from cryptography.hazmat.primitives import constant_time, interfaces
+from cryptography.hazmat.primitives import constant_time, mac
from cryptography.hazmat.primitives.ciphers.modes import CBC
-@utils.register_interface(interfaces.MACContext)
+@utils.register_interface(mac.MACContext)
class _CMACContext(object):
def __init__(self, backend, algorithm, ctx=None):
if not backend.cmac_algorithm_supported(algorithm):
diff --git a/src/cryptography/hazmat/backends/openssl/hmac.py b/src/cryptography/hazmat/backends/openssl/hmac.py
index dff3742d..ea834204 100644
--- a/src/cryptography/hazmat/backends/openssl/hmac.py
+++ b/src/cryptography/hazmat/backends/openssl/hmac.py
@@ -9,10 +9,10 @@ from cryptography import utils
from cryptography.exceptions import (
InvalidSignature, UnsupportedAlgorithm, _Reasons
)
-from cryptography.hazmat.primitives import constant_time, hashes, interfaces
+from cryptography.hazmat.primitives import constant_time, hashes, mac
-@utils.register_interface(interfaces.MACContext)
+@utils.register_interface(mac.MACContext)
@utils.register_interface(hashes.HashContext)
class _HMACContext(object):
def __init__(self, backend, key, algorithm, ctx=None):
diff --git a/src/cryptography/hazmat/primitives/cmac.py b/src/cryptography/hazmat/primitives/cmac.py
index c2038a30..77537f04 100644
--- a/src/cryptography/hazmat/primitives/cmac.py
+++ b/src/cryptography/hazmat/primitives/cmac.py
@@ -9,10 +9,10 @@ from cryptography.exceptions import (
AlreadyFinalized, UnsupportedAlgorithm, _Reasons
)
from cryptography.hazmat.backends.interfaces import CMACBackend
-from cryptography.hazmat.primitives import ciphers, interfaces
+from cryptography.hazmat.primitives import ciphers, mac
-@utils.register_interface(interfaces.MACContext)
+@utils.register_interface(mac.MACContext)
class CMAC(object):
def __init__(self, algorithm, backend, ctx=None):
if not isinstance(backend, CMACBackend):
diff --git a/src/cryptography/hazmat/primitives/hmac.py b/src/cryptography/hazmat/primitives/hmac.py
index 15b9ee6e..2e9a4e2f 100644
--- a/src/cryptography/hazmat/primitives/hmac.py
+++ b/src/cryptography/hazmat/primitives/hmac.py
@@ -9,10 +9,10 @@ from cryptography.exceptions import (
AlreadyFinalized, UnsupportedAlgorithm, _Reasons
)
from cryptography.hazmat.backends.interfaces import HMACBackend
-from cryptography.hazmat.primitives import hashes, interfaces
+from cryptography.hazmat.primitives import hashes, mac
-@utils.register_interface(interfaces.MACContext)
+@utils.register_interface(mac.MACContext)
@utils.register_interface(hashes.HashContext)
class HMAC(object):
def __init__(self, key, algorithm, backend, ctx=None):
diff --git a/src/cryptography/hazmat/primitives/interfaces.py b/src/cryptography/hazmat/primitives/interfaces.py
new file mode 100644
index 00000000..c9fdb3bf
--- /dev/null
+++ b/src/cryptography/hazmat/primitives/interfaces.py
@@ -0,0 +1,17 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+from __future__ import absolute_import, division, print_function
+
+from cryptography import utils
+from cryptography.hazmat.primitives.mac import MACContext as _MACContext
+
+
+MACContext = utils.deprecated(
+ _MACContext,
+ __name__,
+ "MACContext was moved to cryptography.hazmat.primitives.mac.MACContext "
+ "in version 1.9.",
+ utils.DeprecatedIn19
+)
diff --git a/src/cryptography/hazmat/primitives/interfaces/__init__.py b/src/cryptography/hazmat/primitives/mac.py
index 4c95190b..4c95190b 100644
--- a/src/cryptography/hazmat/primitives/interfaces/__init__.py
+++ b/src/cryptography/hazmat/primitives/mac.py