hkdfSha256DeriveKey method

  1. @override
BuBytes hkdfSha256DeriveKey({
  1. required List<int> ikm,
  2. int length = 32,
  3. List<int>? salt,
  4. List<int>? info,
})
override

Strict RFC 5869 HKDF-SHA-256 (always Extract-then-Expand). Omitted salt defaults to 32 zero bytes (ยง2.2) on every backend; info may be empty. length must be 1..255*32. Throws on invalid arguments or backend failure.

Implementation

@override
BuBytes hkdfSha256DeriveKey({
  required List<int> ikm,
  int length = 32,
  List<int>? salt,
  List<int>? info,
}) {
  final result = BuHkdf(
    bindings: _bindings,
    prf: BuKdfPrf.sha256,
    ikm: BuBytes(ikm),
    salt: salt == null ? null : BuBytes(salt),
    info: info == null ? null : BuBytes(info),
  ).expand(length: length);
  return result.unwrapOrThrowCryptoError().asBytes;
}