Table of Contents

Class Sp800108Kdf

Namespace
Kdf108
Assembly
Kdf108.dll

The logging implementation of ISp800108Kdf. Stateless and thread-safe.

public sealed class Sp800108Kdf : ISp800108Kdf
Inheritance
Sp800108Kdf
Implements
Inherited Members

Constructors

Sp800108Kdf(ILogger<Sp800108Kdf>?)

The logging implementation of ISp800108Kdf. Stateless and thread-safe.

public Sp800108Kdf(ILogger<Sp800108Kdf>? logger = null)

Parameters

logger ILogger<Sp800108Kdf>

Methods

Derive(ReadOnlySpan<byte>, Prf, KeyExpansion, BitLength)

Derives key material with any SP 800-108 mode and counter layout.

public byte[] Derive(ReadOnlySpan<byte> keyDerivationKey, Prf prf, KeyExpansion expansion, BitLength length)

Parameters

keyDerivationKey ReadOnlySpan<byte>

The key-derivation key K_IN.

prf Prf

The PRF.

expansion KeyExpansion

The mode, fixed input, and counter layout.

length BitLength

The 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.

public byte[] Derive(ReadOnlySpan<byte> keyDerivationKey, Prf prf, ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, BitLength length)

Parameters

keyDerivationKey ReadOnlySpan<byte>

The key-derivation key K_IN.

prf Prf

The PRF, for example Prf.Hmac(NistHashAlgorithm.Sha256).

label ReadOnlySpan<byte>

Identifies the purpose of the derived key.

context ReadOnlySpan<byte>

Binds the key to the parties, session, or other context.

length BitLength

The 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.

public byte[] DeriveKmac(ReadOnlySpan<byte> keyDerivationKey, KmacVariant variant, ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, BitLength length)

Parameters

keyDerivationKey ReadOnlySpan<byte>

The KMAC key. At least 16 bytes for KMAC128 or 32 bytes for KMAC256.

variant KmacVariant

KMAC128 or KMAC256.

label ReadOnlySpan<byte>

The KMAC customization string S.

context ReadOnlySpan<byte>

The KMAC input X.

length BitLength

The output length L. Must be a whole number of bytes.

Returns

byte[]