deriveKey

suspend fun deriveKey(algorithm: Algorithm, ikm: SecureByteString, salt: ByteArray?, info: ByteArray, length: Int): SecretKey

Derives a symmetric encryption key according to HKDF as defined by RFC 5869, taking a SecureByteString and returning a SecretKey.

Return

output keying material of length octets as a SecretKey.

Parameters

algorithm

the KDF algorithm to use e.g. Algorithm.HMAC_SHA256.

ikm

input key material as a SecureByteString.

salt

optional salt value (a non-secret random value).

info

context and application specific information (can be zero-length).

length

length of output keying material in octets.

Throws

if the algorithm is not supported or length is invalid.

if ikm has been destroyed.