Interface ISp800108Kdf
- Namespace
- Kdf108
- Assembly
- Kdf108.dll
SP 800-108 key derivation as an injectable service. Mirrors Sp800108; inject it, or construct Sp800108Kdf directly.
public interface ISp800108Kdf
Methods
Derive(ReadOnlySpan<byte>, Prf, KeyExpansion, BitLength)
Derives key material with any SP 800-108 mode and counter layout.
byte[] Derive(ReadOnlySpan<byte> keyDerivationKey, Prf prf, KeyExpansion expansion, BitLength length)
Parameters
keyDerivationKeyReadOnlySpan<byte>The key-derivation key K_IN.
prfPrfThe PRF.
expansionKeyExpansionThe mode, fixed input, and counter layout.
lengthBitLengthThe output length L.
Returns
- byte[]
Derive(ReadOnlySpan<byte>, Prf, ReadOnlySpan<byte>, ReadOnlySpan<byte>, BitLength)
Derives key material in counter mode with a 32-bit counter and the conventional fixed input
Label || 0x00 || Context || [L]32. This is the right call for most applications.
byte[] Derive(ReadOnlySpan<byte> keyDerivationKey, Prf prf, ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, BitLength length)
Parameters
keyDerivationKeyReadOnlySpan<byte>The key-derivation key K_IN.
prfPrfThe PRF, for example
Prf.Hmac(NistHashAlgorithm.Sha256).labelReadOnlySpan<byte>Identifies the purpose of the derived key.
contextReadOnlySpan<byte>Binds the key to the parties, session, or other context.
lengthBitLengthThe output length L.
Returns
- byte[]
DeriveKmac(ReadOnlySpan<byte>, KmacVariant, ReadOnlySpan<byte>, ReadOnlySpan<byte>, BitLength)
The KMAC-based KDF from SP 800-108 Rev. 1 ยง4.4: one KMAC call with Context as input and Label as customization.
byte[] DeriveKmac(ReadOnlySpan<byte> keyDerivationKey, KmacVariant variant, ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, BitLength length)
Parameters
keyDerivationKeyReadOnlySpan<byte>The KMAC key. At least 16 bytes for KMAC128 or 32 bytes for KMAC256.
variantKmacVariantKMAC128 or KMAC256.
labelReadOnlySpan<byte>The KMAC customization string S.
contextReadOnlySpan<byte>The KMAC input X.
lengthBitLengthThe output length L. Must be a whole number of bytes.
Returns
- byte[]