aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-05-07 16:22:09 +0800
committerAyrx <terrycwk1994@gmail.com>2014-05-07 16:22:09 +0800
commitc0ce911b4e971f3090d406cb88dea532647eeac6 (patch)
tree50eab3ca8d17a9f816468ad922855d5cd8eb351d
parent9d72f12dcb28191f87fde9740899a39060e14495 (diff)
downloadcryptography-c0ce911b4e971f3090d406cb88dea532647eeac6.tar.gz
cryptography-c0ce911b4e971f3090d406cb88dea532647eeac6.tar.bz2
cryptography-c0ce911b4e971f3090d406cb88dea532647eeac6.zip
Renamed HKDFExpandOnly to HKDFExpand
-rw-r--r--cryptography/hazmat/primitives/kdf/hkdf.py2
-rw-r--r--docs/hazmat/primitives/key-derivation-functions.rst10
-rw-r--r--tests/hazmat/primitives/test_hkdf.py14
3 files changed, 13 insertions, 13 deletions
diff --git a/cryptography/hazmat/primitives/kdf/hkdf.py b/cryptography/hazmat/primitives/kdf/hkdf.py
index 6d34a0f7..44e14817 100644
--- a/cryptography/hazmat/primitives/kdf/hkdf.py
+++ b/cryptography/hazmat/primitives/kdf/hkdf.py
@@ -103,7 +103,7 @@ class HKDF(object):
@utils.register_interface(interfaces.KeyDerivationFunction)
-class HKDFExpandOnly(HKDF):
+class HKDFExpand(HKDF):
def __init__(self, algorithm, length, info, backend):
HKDF.__init__(self, algorithm, length, None, info, backend)
diff --git a/docs/hazmat/primitives/key-derivation-functions.rst b/docs/hazmat/primitives/key-derivation-functions.rst
index 9b76bf64..11fbd4e0 100644
--- a/docs/hazmat/primitives/key-derivation-functions.rst
+++ b/docs/hazmat/primitives/key-derivation-functions.rst
@@ -220,7 +220,7 @@ Different KDFs are suitable for different tasks such as:
raises an exception if they do not match.
-.. class:: HKDFExpandOnly(algorithm, length, info, backend)
+.. class:: HKDFExpand(algorithm, length, info, backend)
.. versionadded:: 0.5
@@ -230,7 +230,7 @@ Different KDFs are suitable for different tasks such as:
.. warning::
- HKDFExpandOnly should only be used if the key material is
+ HKDFExpand should only be used if the key material is
cryptographically strong. You should use
:class:`~cryptography.hazmat.primitives.kdf.hkdf.HKDF` if
you are unsure.
@@ -239,19 +239,19 @@ Different KDFs are suitable for different tasks such as:
>>> import os
>>> from cryptography.hazmat.primitives import hashes
- >>> from cryptography.hazmat.primitives.kdf.hkdf import HKDFExpandOnly
+ >>> from cryptography.hazmat.primitives.kdf.hkdf import HKDFExpand
>>> from cryptography.hazmat.backends import default_backend
>>> backend = default_backend()
>>> info = b"hkdf-example"
>>> key_material = os.urandom(16)
- >>> hkdf = HKDFExpandOnly(
+ >>> hkdf = HKDFExpand(
... algorithm=hashes.SHA256(),
... length=32,
... info=info,
... backend=backend
... )
>>> key = hkdf.derive(key_material)
- >>> hkdf = HKDFExpandOnly(
+ >>> hkdf = HKDFExpand(
... algorithm=hashes.SHA256(),
... length=32,
... info=info,
diff --git a/tests/hazmat/primitives/test_hkdf.py b/tests/hazmat/primitives/test_hkdf.py
index 904ed69c..bee42172 100644
--- a/tests/hazmat/primitives/test_hkdf.py
+++ b/tests/hazmat/primitives/test_hkdf.py
@@ -23,7 +23,7 @@ from cryptography.exceptions import (
AlreadyFinalized, InvalidKey, _Reasons
)
from cryptography.hazmat.primitives import hashes
-from cryptography.hazmat.primitives.kdf.hkdf import HKDF, HKDFExpandOnly
+from cryptography.hazmat.primitives.kdf.hkdf import HKDF, HKDFExpand
from ...utils import raises_unsupported_algorithm
@@ -154,7 +154,7 @@ class TestHKDF(object):
@pytest.mark.hmac
-class TestHKDFExpandOnly(object):
+class TestHKDFExpand(object):
def test_derive(self, backend):
prk = binascii.unhexlify(
b"077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5"
@@ -164,7 +164,7 @@ class TestHKDFExpandOnly(object):
b"5bf34007208d5b887185865")
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
- hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
+ hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
assert binascii.hexlify(hkdf.derive(prk)) == okm
@@ -177,7 +177,7 @@ class TestHKDFExpandOnly(object):
b"5bf34007208d5b887185865")
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
- hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
+ hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
assert hkdf.verify(prk, binascii.unhexlify(okm)) is None
@@ -187,14 +187,14 @@ class TestHKDFExpandOnly(object):
)
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
- hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
+ hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
with pytest.raises(InvalidKey):
hkdf.verify(prk, b"wrong key")
def test_already_finalized(self, backend):
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
- hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
+ hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
hkdf.derive(b"first")
@@ -203,7 +203,7 @@ class TestHKDFExpandOnly(object):
def test_unicode_error(self, backend):
info = binascii.unhexlify(b"f0f1f2f3f4f5f6f7f8f9")
- hkdf = HKDFExpandOnly(hashes.SHA256(), 42, info, backend)
+ hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
with pytest.raises(TypeError):
hkdf.derive(six.u("first"))