aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-05-06 13:33:48 +0800
committerAyrx <terrycwk1994@gmail.com>2014-05-06 13:33:48 +0800
commit7cc0c834ff41f6309d0ccba7a5e3534932702bf8 (patch)
tree4727fa4039147ab6f3fb50130c8141ccf3e92ce8
parentf1981a612ea70710138a701138c269655b16985b (diff)
downloadcryptography-7cc0c834ff41f6309d0ccba7a5e3534932702bf8.tar.gz
cryptography-7cc0c834ff41f6309d0ccba7a5e3534932702bf8.tar.bz2
cryptography-7cc0c834ff41f6309d0ccba7a5e3534932702bf8.zip
Fixed test failures
-rw-r--r--cryptography/hazmat/primitives/kdf/hkdf.py1
-rw-r--r--tests/hazmat/primitives/test_hkdf.py8
2 files changed, 5 insertions, 4 deletions
diff --git a/cryptography/hazmat/primitives/kdf/hkdf.py b/cryptography/hazmat/primitives/kdf/hkdf.py
index 78c5bfc1..6d34a0f7 100644
--- a/cryptography/hazmat/primitives/kdf/hkdf.py
+++ b/cryptography/hazmat/primitives/kdf/hkdf.py
@@ -101,6 +101,7 @@ class HKDF(object):
if not constant_time.bytes_eq(self.derive(key_material), expected_key):
raise InvalidKey
+
@utils.register_interface(interfaces.KeyDerivationFunction)
class HKDFExpandOnly(HKDF):
def __init__(self, algorithm, length, info, backend):
diff --git a/tests/hazmat/primitives/test_hkdf.py b/tests/hazmat/primitives/test_hkdf.py
index f46ca1c0..904ed69c 100644
--- a/tests/hazmat/primitives/test_hkdf.py
+++ b/tests/hazmat/primitives/test_hkdf.py
@@ -161,7 +161,7 @@ class TestHKDFExpandOnly(object):
)
okm = (b"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c"
- "5bf34007208d5b887185865")
+ b"5bf34007208d5b887185865")
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
@@ -174,7 +174,7 @@ class TestHKDFExpandOnly(object):
)
okm = (b"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c"
- "5bf34007208d5b887185865")
+ b"5bf34007208d5b887185865")
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
@@ -196,10 +196,10 @@ class TestHKDFExpandOnly(object):
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
- hkdf.derive("first")
+ hkdf.derive(b"first")
with pytest.raises(AlreadyFinalized):
- hkdf.derive("second")
+ hkdf.derive(b"second")
def test_unicode_error(self, backend):
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")