public class KDF2ParameterSpec extends KDF1ParameterSpec
Algorithm parameter specification for the KDF2 Key Derivation Function (KDF).
This class holds all information needed for using the KDF2. This includes the used hash algorithm, the desired key length, the secret value, and the additional information. We use this approach, as the KDF2 is implemented using the KeyGenerator class, and and KeyGenerator.generateKey() is not parameterized.
Constructor and Description |
---|
KDF2ParameterSpec(AlgorithmID hashAlgorithm,
int keyLength)
Creates a new KDF2ParameterSpec for the hash algorithm to be used with KDF2 and
the desired key length.
|
KDF2ParameterSpec(AlgorithmID hashAlgorithm,
int keyLength,
byte[] secretValue)
Creates a new KDF2ParameterSpec for the hash algorithm to be used with KDF2,
the desired key length, and the secret value.
|
KDF2ParameterSpec(AlgorithmID hashAlgorithm,
int keyLength,
byte[] secretValue,
byte[] otherInfo)
Creates a new KDF2ParameterSpec for the hash algorithm to be used with KDF2,
the desired key length, the secret value, and the additional information.
|
Modifier and Type | Method and Description |
---|---|
AlgorithmID |
getAlgorithmId()
Returns the AlgorithmID of the KDF associated with this class.
|
java.lang.String |
getKdf()
Returns the name of the KDF associated with this class.
|
getKeyLength, getOtherInfo, getSecretValue, setKeyLength, setOtherInfo, setSecretValue
getHashAlgorithm, getHashEngine, setHashEngine, toString
getSecureRandom, setSecureRandom
public KDF2ParameterSpec(AlgorithmID hashAlgorithm, int keyLength)
hashAlgorithm
- the hash algorithm IDkeyLength
- the desired key lengthpublic KDF2ParameterSpec(AlgorithmID hashAlgorithm, int keyLength, byte[] secretValue)
hashAlgorithm
- the hash algorithm IDkeyLength
- the desired key lengthsecretValue
- the secret value used for key derivationpublic KDF2ParameterSpec(AlgorithmID hashAlgorithm, int keyLength, byte[] secretValue, byte[] otherInfo)
hashAlgorithm
- the hash algorithm IDkeyLength
- the desired key lengthsecretValue
- the secret value used for key derivationotherInfo
- the additional information for key derivationpublic AlgorithmID getAlgorithmId()
getAlgorithmId
in interface KeyDerivationParameterSpec
getAlgorithmId
in class KDF1ParameterSpec
public java.lang.String getKdf()
getKdf
in interface KeyDerivationParameterSpec
getKdf
in class KDF1ParameterSpec