Constructor and Description |
---|
PBEKeySpec(char[] password)
Creates a new
PBEKeySpec with the specified password. |
PBEKeySpec(char[] password,
byte[] salt,
int iterationCount)
Creates a new
PBEKeySpec with the specified password, salt
and iteration count. |
PBEKeySpec(char[] password,
byte[] salt,
int iterationCount,
int keyLength)
Creates a new
PBEKeySpec with the specified password, salt,
iteration count and the desired length of the derived key. |
Modifier and Type | Method and Description |
---|---|
void |
clearPassword()
Clears the password by overwriting it.
|
int |
getIterationCount()
Returns the iteration count of this key specification.
|
int |
getKeyLength()
Returns the desired key length of the derived key.
|
char[] |
getPassword()
Returns a copy of the password of this key specification.
|
byte[] |
getSalt()
Returns a copy of the salt of this key specification.
|
public PBEKeySpec(char[] password)
PBEKeySpec
with the specified password.password
- the password.public PBEKeySpec(char[] password, byte[] salt, int iterationCount, int keyLength)
PBEKeySpec
with the specified password, salt,
iteration count and the desired length of the derived key.password
- the password.salt
- the salt.iterationCount
- the iteration count.keyLength
- the desired key length of the derived key,NullPointerException
- if the salt is null.IllegalArgumentException
- if the salt is empty, iteration count is zero or negative or
the key length is zero or negative.public PBEKeySpec(char[] password, byte[] salt, int iterationCount)
PBEKeySpec
with the specified password, salt
and iteration count.password
- the password.salt
- the salt.iterationCount
- the iteration count.NullPointerException
- if salt is null.IllegalArgumentException
- if the salt is empty or iteration count is zero or negative.public final void clearPassword()
public final char[] getPassword()
IllegalStateException
- if the password has been cleared before.public final byte[] getSalt()
public final int getIterationCount()
public final int getKeyLength()