|
Bouncy Castle Cryptography Library 1.87 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.bouncycastle.crypto.generators.OneStepKDFBytesGenerator
The one-step key derivation function of NIST SP 800-56C Rev. 2, Section 4.1, with any of its three auxiliary functions: a hash (Option 1), HMAC keyed with the salt (Option 2), or KMAC keyed with the salt and customised with "KDF" (Option 3).
For the hash and HMAC options the output is the concatenation of H(counter || Z || FixedInfo) for a
32-bit big-endian counter starting at 1, truncated to the requested length; with the hash option this is
the Concatenation KDF of SP 800-56A (ConcatenationKDFGenerator).
With the KMAC option the standard sets the KMAC output length to the requested length so that a single
call, with the counter at 1, produces the whole output. When no salt is given the default salt of the
standard is used: for HMAC an all-zero string the size of the hash block (which HMAC's key padding makes
equivalent to an empty key), for KMAC128 164 zero bytes and for KMAC256 132 zero bytes.
Initialise with a KDFParameters carrying the shared secret Z and the FixedInfo.
| Constructor Summary | |
OneStepKDFBytesGenerator(Digest digest)
Option 1: a hash function as the auxiliary function. |
|
OneStepKDFBytesGenerator(Mac mac,
byte[] salt)
Option 2 or 3: HMAC or KMAC as the auxiliary function, keyed with the salt. |
|
| Method Summary | |
int |
generateBytes(byte[] out,
int outOff,
int len)
|
Digest |
getDigest()
|
void |
init(DerivationParameters param)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public OneStepKDFBytesGenerator(Digest digest)
digest - the hash function.
public OneStepKDFBytesGenerator(Mac mac,
byte[] salt)
mac - the HMAC or KMAC to use.salt - the salt, or null for the standard's default salt.| Method Detail |
public void init(DerivationParameters param)
init in interface DerivationFunctionpublic Digest getDigest()
public int generateBytes(byte[] out,
int outOff,
int len)
throws DataLengthException,
java.lang.IllegalArgumentException
generateBytes in interface DerivationFunctionDataLengthException
java.lang.IllegalArgumentException
|
Bouncy Castle Cryptography Library 1.87 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||