Bouncy Castle Cryptography Library 1.87

org.bouncycastle.jcajce.spec
Class KBKDFParameterSpec

java.lang.Object
  extended byorg.bouncycastle.jcajce.spec.KBKDFParameterSpec
All Implemented Interfaces:
java.security.spec.AlgorithmParameterSpec

public class KBKDFParameterSpec
extends java.lang.Object
implements java.security.spec.AlgorithmParameterSpec

Derivation parameters for the NIST SP 800-108 Rev. 1 key-based key derivation functions (, "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
KBKDFParameterSpec(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
 int getCounterBits()
           
 byte[] getFixedInputData()
           
 byte[] getIV()
           
 byte[] getKeyIn()
           
 int getOutputLength()
           
 KBKDFParameterSpec withIV(byte[] iv)
          Return a copy of this spec with the IV feedback mode chains from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

withIV

public KBKDFParameterSpec withIV(byte[] iv)
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.

Bouncy Castle Cryptography Library 1.87