|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.crypto.provider.PKCS5DerivedKeySpec
public class PKCS5DerivedKeySpec
Specification for a derived key as defined by PKCS#5. These derived keys take a password, salt, iteration count, and key length as arguments to a hash function for (PBKDF1-derived keys) or a pseudorandom function (PBKDF2-derived keys).
Note that this class stores passwords as char arrays instead of
String
objects (which would seem more logical), because the
String class is immutable and there is no way to overwrite its
internal value when the password stored in it is no longer needed. Hence,
this class requests the password as a char array, so it can be overwritten
when done.
Constructor Summary | |
---|---|
PKCS5DerivedKeySpec(char[] pwd,
byte[] salt,
int iterations,
int keyLength,
String function)
Constructor that takes a password, salt, interation count, key length and key encryption function. |
Method Summary | |
---|---|
protected void |
finalize()
Ensures that the password characters of this spec are set to blanks when there are no more references to it. |
String |
getAlgorithm()
Returns the algorithm that the key will be used in. |
String |
getEncryptionFunction()
Returns the encryption function used to encrypt the key. |
int |
getIterationCount()
Returns the iteration count. |
int |
getKeyLength()
Returns the key length. |
char[] |
getPassword()
Returns the password. |
byte[] |
getSalt()
Returns the salt. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PKCS5DerivedKeySpec(char[] pwd, byte[] salt, int iterations, int keyLength, String function)
Note that the given password is cloned before it is stored in
the new PKCS5DerivedKeySpec
object.
pwd
- the password.salt
- the salt.iterations
- the iteration count.keyLength
- the key length.function
- the encryption function.Method Detail |
---|
public final char[] getPassword()
Note that this method returns a reference to the password. It is the caller's responsibility to zero out the password information after it is no longer needed.
public final byte[] getSalt()
public final int getIterationCount()
public final int getKeyLength()
public final String getAlgorithm()
public final String getEncryptionFunction()
protected void finalize()
finalize
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |