aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_pbkdf2hmac.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2019-01-17 15:53:16 -0600
committerAlex Gaynor <alex.gaynor@gmail.com>2019-01-17 16:53:16 -0500
commit62e22a5fb9d3e093f44b4075c7ddb5807d66409b (patch)
treed8b001ebeb9d26c731c14a441933b0045fd35f6a /tests/hazmat/primitives/test_pbkdf2hmac.py
parent7f63e5b65d14dca6c4783d62fa5937a5a5c705e7 (diff)
downloadcryptography-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 'tests/hazmat/primitives/test_pbkdf2hmac.py')
-rw-r--r--tests/hazmat/primitives/test_pbkdf2hmac.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_pbkdf2hmac.py b/tests/hazmat/primitives/test_pbkdf2hmac.py
index d971ebd0..0254b216 100644
--- a/tests/hazmat/primitives/test_pbkdf2hmac.py
+++ b/tests/hazmat/primitives/test_pbkdf2hmac.py
@@ -57,6 +57,11 @@ class TestPBKDF2HMAC(object):
with pytest.raises(TypeError):
kdf.derive(u"unicode here")
+ def test_buffer_protocol(self, backend):
+ kdf = PBKDF2HMAC(hashes.SHA1(), 10, b"salt", 10, default_backend())
+ data = bytearray(b"data")
+ assert kdf.derive(data) == b"\xe9n\xaa\x81\xbbt\xa4\xf6\x08\xce"
+
def test_invalid_backend():
pretend_backend = object()