|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.crypto.spec.PBEKeySpec
public class PBEKeySpec
A wrapper for a password-based key, used for password-based encryption (PBE).
Examples of password-based encryption algorithms include:
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PBEKeySpec(char[] password)
A copy of the password argument is stored instead of the argument itself.
password
- The password char array.public PBEKeySpec(char[] password, byte[] salt, int iterationCount)
A copy of the password and salt arguments are stored instead of the arguments themselves.
password
- The password char array.salt
- The salt bytes.iterationCount
- The iteration count.
NullPointerException
- If salt is null
IllegalArgumentException
- If salt is an empty array, or
iterationCount is negativepublic PBEKeySpec(char[] password, byte[] salt, int iterationCount, int keyLength)
A copy of the password and salt arguments are stored instead of the arguments themselves.
password
- The password char array.salt
- The salt bytes.iterationCount
- The iteration count.keyLength
- The generated key length.
NullPointerException
- If salt is null
IllegalArgumentException
- If salt is an empty array, if
iterationCount or keyLength is negativeMethod Detail |
---|
public final void clearPassword()
This clears the stored copy of the password, not the original char array used to create the password.
public final int getIterationCount()
public final int getKeyLength()
public final char[] getPassword()
This returns a copy of the password, not the password itself.
IllegalStateException
- If clearPassword()
has already been
called.public final byte[] getSalt()
This returns a copy of the salt, not the salt itself.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |