javax.crypto.spec
public class PBEKeySpec extends Object implements KeySpec
Examples of password-based encryption algorithms include:
Since: 1.4
See Also: SecretKeyFactory PBEParameterSpec
Constructor Summary | |
---|---|
PBEKeySpec(char[] password)
Create a new PBE key spec with just a password.
| |
PBEKeySpec(char[] password, byte[] salt, int iterationCount)
Create a PBE key spec with a password, salt, and iteration count.
| |
PBEKeySpec(char[] password, byte[] salt, int iterationCount, int keyLength)
Create a PBE key spec with a password, salt, iteration count, and key
length.
|
Method Summary | |
---|---|
void | clearPassword()
Clear the password array by filling it with null characters.
|
int | getIterationCount()
Get the iteration count, or 0 if it has not been specified.
|
int | getKeyLength()
Get the generated key length, or 0 if it has not been specified.
|
char[] | getPassword()
Get the password character array copy.
|
byte[] | getSalt()
Get the salt bytes array copy.
|
A copy of the password argument is stored instead of the argument itself.
Parameters: password The password char array.
A copy of the password and salt arguments are stored instead of the arguments themselves.
Parameters: password The password char array. salt The salt bytes. iterationCount The iteration count.
Throws: NullPointerException If salt is null IllegalArgumentException If salt is an empty array, or iterationCount is negative
A copy of the password and salt arguments are stored instead of the arguments themselves.
Parameters: password The password char array. salt The salt bytes. iterationCount The iteration count. keyLength The generated key length.
Throws: NullPointerException If salt is null IllegalArgumentException If salt is an empty array, if iterationCount or keyLength is negative
This clears the stored copy of the password, not the original char array used to create the password.
Returns: The iteration count, or 0 if it has not been specified.
Returns: The key length, or 0 if it has not been specified.
This returns a copy of the password, not the password itself.
Returns: a clone of the password.
Throws: IllegalStateException If {@link #clearPassword()} has already been called.
This returns a copy of the salt, not the salt itself.
Returns: The salt.