Modifier and Type | Method and Description |
---|---|
byte[] |
deriveKey(byte[] info,
int length)
Returns a pseudorandom key of
length bytes. |
static HmacKeyDerivationFunction |
getInstance(String algorithm)
Returns an
HmacKeyDerivationFunction object using the specified algorithm. |
void |
init(byte[] ikm)
Initializes this Hkdf with input keying material.
|
void |
init(byte[] ikm,
byte[] salt)
Initializes this Hkdf with input keying material and a salt.
|
public static HmacKeyDerivationFunction getInstance(String algorithm) throws NoSuchAlgorithmException
HmacKeyDerivationFunction
object using the specified algorithm.algorithm
- the standard name of the requested MAC algorithm. See the Mac section in the
Java Cryptography Architecture Standard Algorithm Name Documentation for information
about standard algorithm names.Hkdf
objectNoSuchAlgorithmException
- if no Provider supports a MacSpi implementation for the
specified algorithm.public void init(byte[] ikm)
ikm
- the Input Keying Materialpublic void init(byte[] ikm, byte[] salt)
salt
is null
or of length 0, then a default salt of HashLen zeros will be
used (where HashLen is the length of the return value of the supplied algorithm).salt
- the salt used for key extraction (optional)ikm
- the Input Keying Materialpublic byte[] deriveKey(byte[] info, int length) throws IllegalStateException
length
bytes.info
- optional context and application specific information (can be a zero-length array).length
- the length of the output key in byteslength
bytes.IllegalStateException
- if this object has not been initializedCopyright © 2023. All rights reserved.