base\Security hkdf()

hkdf() public method

Derives a key from the given input key using the standard HKDF algorithm.

Implements HKDF specified in RFC 5869. Recommend use one of the SHA-2 hash algorithms: sha224, sha256, sha384 or sha512.

public string hkdf ( $algo, $inputKey, $salt = null, $info = null, $length = 0 )
$algo string

A hash algorithm supported by hash_hmac(), e.g. 'SHA-256'

$inputKey string

The source key

$salt string

The random salt

$info string

Optional info to bind the derived key material to application- and context-specific information, e.g. a user ID or API version, see RFC 5869

$length integer

Length of the output key in bytes. If 0, the output key is the length of the hash algorithm output.

return string

The derived key

throws yii\base\InvalidParamException

when HMAC generation fails.

doc_Yii
2016-10-30 16:52:22
Comments
Leave a Comment

Please login to continue.