Coverage for nuts.hkdf : 87%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
''' Extract a pseudorandom key suitable for use with hkdf_expand from the input_key_material and a salt using HMAC with the provided hash (default SHA-512).
salt should be a random, application-specific byte string. If salt is None or the empty string, an all-zeros string of the same length as the hash's block size will be used instead per the RFC.
See the HKDF draft RFC and paper for usage notes. ''' salt = chr(0) * hash_len
''' Expand `pseudo_random_key` and `info` into a key of length `bytes` using HKDF's expand function based on HMAC with the provided hash (default SHA-512). See the HKDF draft RFC and paper for usage notes. ''' raise Exception("Cannot expand to more than 255 * %d = %d bytes using the specified hash function" %\ (hash_len, 255 * hash_len))
''' Wrapper class for HKDF extract and expand functions '''
''' Extract a pseudorandom key from `salt` and `input_key_material` arguments.
See the HKDF draft RFC for guidance on setting these values. The constructor optionally takes a `hash` arugment defining the hash function use, defaulting to hashlib.sha256. '''
''' Generate output key material based on an `info` value
Arguments: - info - context to generate the OKM - length - length in bytes of the key to generate
See the HKDF draft RFC for guidance. ''' |