public final class SingleStepKdf extends Object
Formally described as:
A family of one-step key-derivation functions is specified as follows: Function call: KDM( Z, OtherInput ).
Options for the Auxiliary Function H:
see https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr1.pdf
| Modifier and Type | Method and Description |
|---|---|
byte[] |
derive(byte[] sharedSecretZ,
int outLengthBytes)
KDM - a one step key derivation function as described in NIST SP 800-56C REV.
|
byte[] |
derive(byte[] sharedSecretZ,
int outLengthBytes,
byte[] fixedInfo)
KDM - a one step key derivation function as described in NIST SP 800-56C REV.
|
byte[] |
derive(byte[] sharedSecretZ,
int outLengthBytes,
byte[] salt,
byte[] fixedInfo)
KDM - a one step key derivation function as described in NIST SP 800-56C REV.
|
static SingleStepKdf |
from(HFunctionFactory factory) |
static SingleStepKdf |
fromHmacSha256() |
static SingleStepKdf |
fromHmacSha512() |
static SingleStepKdf |
fromSha256() |
static SingleStepKdf |
fromSha512() |
String |
getHFunctionDescription()
Get a user readable description of the used H-function (e.g.
|
public static SingleStepKdf fromSha256()
public static SingleStepKdf fromSha512()
public static SingleStepKdf fromHmacSha256()
public static SingleStepKdf fromHmacSha512()
public static SingleStepKdf from(HFunctionFactory factory)
public String getHFunctionDescription()
public byte[] derive(byte[] sharedSecretZ,
int outLengthBytes)
Derives a new key from given parameters. This call omits the salt which is applicable for KDFs
which use a MessageDigest as underlying H function. This call also uses a
zero length byte array as fixedInfo. Using an empty fixedInfo is a special case and the caller
should have specific reasons to omit it.
sharedSecretZ - called 'Z' in the spec: a byte string that represents the shared secretoutLengthBytes - called 'L' in the spec: a positive integer that indicates the length
(in bytes) of the secret keying material to be derived (ie. how long the output
will be in bytes)public byte[] derive(byte[] sharedSecretZ,
int outLengthBytes,
byte[] fixedInfo)
Derives a new key from given parameters. This call omits the salt which is applicable for KDFs
which use a MessageDigest as underlying H function.
sharedSecretZ - called 'Z' in the spec: a byte string that represents the shared secretoutLengthBytes - called 'L' in the spec: a positive integer that indicates the length
(in bytes) of the secret keying material to be derived (ie. how long the output
will be in bytes)fixedInfo - a bit string of context-specific data that is appropriate for the relying
key-establishment scheme. FixedInfo may, for example, include appropriately
formatted representations of the values of salt and/or L. The inclusion of
additional copies of the values of salt and L in FixedInfo would ensure that
each block of derived keying material is affected by all of the information
conveyed in OtherInput. See [SP 800-56A] and [SP 800-56B] for more detailed
recommendations concerning the format and content of FixedInfo.public byte[] derive(byte[] sharedSecretZ,
int outLengthBytes,
byte[] salt,
byte[] fixedInfo)
Derives a new key from given parameters.
sharedSecretZ - called 'Z' in the spec: a byte string that represents the shared secretoutLengthBytes - called 'L' in the spec: a positive integer that indicates the length
(in bytes) of the secret keying material to be derived (ie. how long the output
will be in bytes)salt - (secret or non-secret) byte string that should be provided when HMAC h
function is used, if null is passed the default_salt is usedfixedInfo - a bit string of context-specific data that is appropriate for the relying
key-establishment scheme. FixedInfo may, for example, include appropriately
formatted representations of the values of salt and/or L. The inclusion of
additional copies of the values of salt and L in FixedInfo would ensure that
each block of derived keying material is affected by all of the information
conveyed in OtherInput. See [SP 800-56A] and [SP 800-56B] for more detailed
recommendations concerning the format and content of FixedInfo.IllegalArgumentException - if salt is used with message digest as H functionCopyright © 2018. All rights reserved.