diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-01-17 15:53:16 -0600 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2019-01-17 16:53:16 -0500 |
commit | 62e22a5fb9d3e093f44b4075c7ddb5807d66409b (patch) | |
tree | d8b001ebeb9d26c731c14a441933b0045fd35f6a /src/cryptography/hazmat/primitives/kdf | |
parent | 7f63e5b65d14dca6c4783d62fa5937a5a5c705e7 (diff) | |
download | cryptography-62e22a5fb9d3e093f44b4075c7ddb5807d66409b.tar.gz cryptography-62e22a5fb9d3e093f44b4075c7ddb5807d66409b.tar.bz2 cryptography-62e22a5fb9d3e093f44b4075c7ddb5807d66409b.zip |
Support byteslike in HKDF and PBKDF2HMAC (#4707)
* support byteslike in HKDF
* support byteslike in PBKDF2HMAC
* add missing docs
Diffstat (limited to 'src/cryptography/hazmat/primitives/kdf')
-rw-r--r-- | src/cryptography/hazmat/primitives/kdf/hkdf.py | 4 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/kdf/pbkdf2.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/cryptography/hazmat/primitives/kdf/hkdf.py b/src/cryptography/hazmat/primitives/kdf/hkdf.py index 27dc9c93..307f91cc 100644 --- a/src/cryptography/hazmat/primitives/kdf/hkdf.py +++ b/src/cryptography/hazmat/primitives/kdf/hkdf.py @@ -43,7 +43,7 @@ class HKDF(object): return h.finalize() def derive(self, key_material): - utils._check_bytes("key_material", key_material) + utils._check_byteslike("key_material", key_material) return self._hkdf_expand.derive(self._extract(key_material)) def verify(self, key_material, expected_key): @@ -98,7 +98,7 @@ class HKDFExpand(object): return b"".join(output)[:self._length] def derive(self, key_material): - utils._check_bytes("key_material", key_material) + utils._check_byteslike("key_material", key_material) if self._used: raise AlreadyFinalized diff --git a/src/cryptography/hazmat/primitives/kdf/pbkdf2.py b/src/cryptography/hazmat/primitives/kdf/pbkdf2.py index fbe8964d..a47b7bbc 100644 --- a/src/cryptography/hazmat/primitives/kdf/pbkdf2.py +++ b/src/cryptography/hazmat/primitives/kdf/pbkdf2.py @@ -41,7 +41,7 @@ class PBKDF2HMAC(object): raise AlreadyFinalized("PBKDF2 instances can only be used once.") self._used = True - utils._check_bytes("key_material", key_material) + utils._check_byteslike("key_material", key_material) return self._backend.derive_pbkdf2_hmac( self._algorithm, self._length, |