Table of Contents

Class Sp80056C

Namespace
Kdf108
Assembly
Kdf108.dll

Key derivation from an SP 800-56A shared secret Z, per NIST SP 800-56C Rev. 2. Use the one-step method, or the two-step method (extract a key-derivation key, then expand it with SP 800-108).

public static class Sp80056C
Inheritance
Sp80056C
Inherited Members

Remarks

Secrets go in as spans and come out as new arrays that the caller owns. The target security strength is checked against the chosen function. Invalid parameters throw KdfParameterException. For dependency injection and logging, use ISp80056CKdf.

Methods

Extract(ReadOnlySpan<byte>, Extraction, SecurityStrength)

The extraction step (§5.1): K_DK = MAC(salt, Z). Expand the result with Sp800108 using ExpansionPrf.

public static byte[] Extract(ReadOnlySpan<byte> sharedSecret, Extraction extraction, SecurityStrength strength)

Parameters

sharedSecret ReadOnlySpan<byte>

Z.

extraction Extraction

HMAC or AES-CMAC extraction and its salt.

strength SecurityStrength

The target security strength, at least 112 bits.

Returns

byte[]

OneStep(ReadOnlySpan<byte>, OneStepFunction, ReadOnlySpan<byte>, BitLength, SecurityStrength)

One-step key derivation (§4): K(i) = H(counter || Z || FixedInfo).

public static byte[] OneStep(ReadOnlySpan<byte> sharedSecret, OneStepFunction function, ReadOnlySpan<byte> fixedInfo, BitLength length, SecurityStrength strength)

Parameters

sharedSecret ReadOnlySpan<byte>

Z.

function OneStepFunction

The auxiliary function H.

fixedInfo ReadOnlySpan<byte>

FixedInfo, for example AlgorithmID || PartyUInfo || PartyVInfo.

length BitLength

The output length L.

strength SecurityStrength

The target security strength, at least 112 bits.

Returns

byte[]

TwoStep(ReadOnlySpan<byte>, Extraction, KeyExpansion, BitLength, SecurityStrength)

Two-step key derivation (§5): extracts a key-derivation key from Z, then expands it with SP 800-108 using the PRF the extraction requires. To derive several keys from one Z, call Extract(ReadOnlySpan<byte>, Extraction, SecurityStrength) once and Derive(ReadOnlySpan<byte>, Prf, KeyExpansion, BitLength) once per key with distinct fixed input.

public static byte[] TwoStep(ReadOnlySpan<byte> sharedSecret, Extraction extraction, KeyExpansion expansion, BitLength length, SecurityStrength strength)

Parameters

sharedSecret ReadOnlySpan<byte>
extraction Extraction
expansion KeyExpansion
length BitLength
strength SecurityStrength

Returns

byte[]