Class KBKDFParameterSpec
java.lang.Object
org.bouncycastle.jcajce.spec.KBKDFParameterSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
Derivation parameters for the NIST SP 800-108 Rev. 1 key-based key derivation functions
(
KDF.getInstance("KBKDF-COUNTER-HMACSHA256"), "KBKDF-FEEDBACK-HMACSHA256",
"KBKDF-PIPELINE-HMACSHA256", ...): the input key K_IN, the fixed input data, the output length, the
counter length and, for feedback mode, the IV.
The KBKDFParameterSpec(byte[], byte[], byte[], int) constructor builds the fixed input data in
the layout the standard's Section 4 suggests, Label || 0x00 || Context || [L]_32 with L the output length
in bits, and uses a 32-bit counter. The counter precedes the fixed input data in counter mode, and
follows the chaining value in feedback and double-pipeline mode; a counter length of 0 omits the
counter in those two modes, as the standard allows.
-
Constructor Summary
ConstructorsConstructorDescriptionKBKDFParameterSpec(byte[] keyIn, byte[] label, byte[] context, int outputLength) The standard layout: Label || 0x00 || Context || [L]_32, with a 32-bit counter.KBKDFParameterSpec(byte[] keyIn, byte[] fixedInputData, int outputLength, int counterBits) Caller-supplied fixed input data. -
Method Summary
-
Constructor Details
-
KBKDFParameterSpec
public KBKDFParameterSpec(byte[] keyIn, byte[] label, byte[] context, int outputLength) The standard layout: Label || 0x00 || Context || [L]_32, with a 32-bit counter.- Parameters:
keyIn- the input key K_IN.label- the label, may be null.context- the context, may be null.outputLength- the number of bytes to derive.
-
KBKDFParameterSpec
public KBKDFParameterSpec(byte[] keyIn, byte[] fixedInputData, int outputLength, int counterBits) Caller-supplied fixed input data.- Parameters:
keyIn- the input key K_IN.fixedInputData- the fixed input data, may be null.outputLength- the number of bytes to derive.counterBits- the counter length in bits: 8, 16, 24 or 32, or 0 for no counter (feedback and double-pipeline mode only).
-
-
Method Details
-
withIV
Return a copy of this spec with the IV feedback mode chains from.- Parameters:
iv- the IV, may be null for an empty IV.- Returns:
- a new spec carrying the IV.
-
getKeyIn
public byte[] getKeyIn() -
getFixedInputData
public byte[] getFixedInputData() -
getOutputLength
public int getOutputLength() -
getCounterBits
public int getCounterBits()- Returns:
- the counter length in bits, 0 for no counter.
-
getIV
public byte[] getIV()- Returns:
- the feedback mode IV, or null if none was given.
-