aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/commoncrypto/backend.py20
-rw-r--r--docs/hazmat/primitives/key-derivation-functions.rst2
2 files changed, 4 insertions, 18 deletions
diff --git a/cryptography/hazmat/backends/commoncrypto/backend.py b/cryptography/hazmat/backends/commoncrypto/backend.py
index 8792c8ac..e5d4ee00 100644
--- a/cryptography/hazmat/backends/commoncrypto/backend.py
+++ b/cryptography/hazmat/backends/commoncrypto/backend.py
@@ -99,20 +99,10 @@ class Backend(object):
}
def hash_supported(self, algorithm):
- try:
- self._hash_mapping[algorithm.name]
- except KeyError:
- return False
- else:
- return True
+ return algorithm.name in self._hash_mapping
def hmac_supported(self, algorithm):
- try:
- self._supported_hmac_algorithms[algorithm.name]
- except KeyError:
- return False
- else:
- return True
+ return algorithm.name in self._supported_hmac_algorithms
def create_hash_ctx(self, algorithm):
return _HashContext(self, algorithm)
@@ -121,11 +111,7 @@ class Backend(object):
return _HMACContext(self, key, algorithm)
def cipher_supported(self, cipher, mode):
- try:
- self._cipher_registry[type(cipher), type(mode)]
- except KeyError:
- return False
- return True
+ return (type(cipher), type(mode)) in self._cipher_registry
def create_symmetric_encryption_ctx(self, cipher, mode):
if isinstance(mode, GCM):
diff --git a/docs/hazmat/primitives/key-derivation-functions.rst b/docs/hazmat/primitives/key-derivation-functions.rst
index 529f4416..551dbd6d 100644
--- a/docs/hazmat/primitives/key-derivation-functions.rst
+++ b/docs/hazmat/primitives/key-derivation-functions.rst
@@ -80,7 +80,7 @@ Different KDFs are suitable for different tasks such as:
keys. See OWASP's `Password Storage Cheat Sheet`_ for more
detailed recommendations if you intend to use this for password storage.
:param backend: A
- :class:`~cryptography.hazmat.backends.interfaces.CipherBackend`
+ :class:`~cryptography.hazmat.backends.interfaces.PBKDF2HMACBackend`
provider.
.. method:: derive(key_material)