public class KDF1ParameterSpec extends MGF1ParameterSpec implements KeyDerivationParameterSpec
Algorithm parameter specification for the KDF1 Key Derivation Function (KDF).
This class holds all information needed for using the KDF1. This includes the used hash algorithm, the desired key length, the secret value, and the additional information. We use this approach, as the KDF1 is implemented using the KeyGenerator class, and and KeyGenerator.generateKey() is not parameterized.
Constructor and Description |
---|
KDF1ParameterSpec(AlgorithmID hashAlgorithm,
int keyLength)
Creates a new KDF1ParameterSpec for the hash algorithm to be used with KDF1 and
the desired key length.
|
KDF1ParameterSpec(AlgorithmID hashAlgorithm,
int keyLength,
byte[] secretValue)
Creates a new KDF1ParameterSpec for the hash algorithm to be used with KDF1,
the desired key length, and the secret value.
|
KDF1ParameterSpec(AlgorithmID hashAlgorithm,
int keyLength,
byte[] secretValue,
byte[] otherInfo)
Creates a new KDF1ParameterSpec for the hash algorithm to be used with KDF1,
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.
|
int |
getKeyLength()
Returns the desired key length.
|
byte[] |
getOtherInfo()
Returns the additional information used for key derivation.
|
byte[] |
getSecretValue()
Returns the secret value used for key derivation.
|
void |
setKeyLength(int keyLength)
Sets the key length.
|
void |
setOtherInfo(byte[] otherInfo)
Sets the additional information used for key derivation.
|
void |
setSecretValue(byte[] secretValue)
Sets the secret value used for key derivation.
|
getHashAlgorithm, getHashEngine, setHashEngine, toString
getSecureRandom, setSecureRandom
public KDF1ParameterSpec(AlgorithmID hashAlgorithm, int keyLength)
hashAlgorithm
- the hash algorithm IDkeyLength
- the desired key lengthpublic KDF1ParameterSpec(AlgorithmID hashAlgorithm, int keyLength, byte[] secretValue)
hashAlgorithm
- the hash algorithm IDkeyLength
- the desired key lengthsecretValue
- the secret value used for key derivationpublic KDF1ParameterSpec(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 int getKeyLength()
getKeyLength
in interface KeyDerivationParameterSpec
public void setKeyLength(int keyLength)
setKeyLength
in interface KeyDerivationParameterSpec
keyLength
- the desired key lengthpublic AlgorithmID getAlgorithmId()
getAlgorithmId
in interface KeyDerivationParameterSpec
public byte[] getSecretValue()
getSecretValue
in interface KeyDerivationParameterSpec
public void setSecretValue(byte[] secretValue)
setSecretValue
in interface KeyDerivationParameterSpec
secretValue
- the secret valuepublic byte[] getOtherInfo()
getOtherInfo
in interface KeyDerivationParameterSpec
public void setOtherInfo(byte[] otherInfo)
setOtherInfo
in interface KeyDerivationParameterSpec
otherInfo
- the additional informationpublic java.lang.String getKdf()
getKdf
in interface KeyDerivationParameterSpec