Lines Matching refs:hkdf
17 from cryptography.hazmat.primitives.kdf.hkdf import HKDF, HKDFExpand
39 hkdf = HKDF(
47 hkdf.derive(b"\x01" * 16)
50 hkdf.derive(b"\x02" * 16)
52 hkdf = HKDF(
60 hkdf.verify(b"\x01" * 16, b"gJ\xfb{\xb1Oi\xc5sMC\xb7\xe4@\xf7u")
63 hkdf.verify(b"\x02" * 16, b"gJ\xfb{\xb1Oi\xc5sMC\xb7\xe4@\xf7u")
65 hkdf = HKDF(
74 hkdf = HKDF(
82 hkdf.verify(b"\x01" * 16, b"gJ\xfb{\xb1Oi\xc5sMC\xb7\xe4@\xf7u")
85 hkdf = HKDF(
94 hkdf.verify(b"\x02" * 16, b"gJ\xfb{\xb1Oi\xc5sMC\xb7\xe4@\xf7u")
116 hkdf = HKDF(
124 hkdf.derive(u"foo")
127 hkdf = HKDF(
135 hkdf.verify(u"foo", b"bar")
138 hkdf = HKDF(
146 hkdf.verify(b"foo", u"bar")
149 hkdf = HKDF(
157 assert hkdf.derive(b"\x01" * 16) == b"gJ\xfb{"
163 hkdf = HKDF(
172 assert hkdf.derive(ikm) == binascii.unhexlify(vector["okm"])
178 hkdf = HKDF(
187 assert hkdf.derive(ikm) == binascii.unhexlify(vector["okm"])
201 hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
203 assert binascii.hexlify(hkdf.derive(prk)) == okm
214 hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
216 assert binascii.hexlify(hkdf.derive(prk)) == okm
227 hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
229 assert hkdf.verify(prk, binascii.unhexlify(okm)) is None
237 hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
240 hkdf.verify(prk, b"wrong key")
244 hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
246 hkdf.derive(b"first")
249 hkdf.derive(b"second")
253 hkdf = HKDFExpand(hashes.SHA256(), 42, info, backend)
256 hkdf.derive(u"first")