Bouncy Castle Cryptography Library 1.87

org.bouncycastle.jcajce
Class PBKDF2Key

java.lang.Object
  extended byorg.bouncycastle.jcajce.PBKDF2Key
All Implemented Interfaces:
java.security.Key, PBKDFKey, javax.crypto.SecretKey, java.io.Serializable
Direct Known Subclasses:
PBKDF2KeyWithParameters

public class PBKDF2Key
extends java.lang.Object
implements PBKDFKey

A password based key for use with PBKDF2 as defined in PKCS#5.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
PBKDF2Key(char[] password, CharToByteConverter converter)
          Basic constructor for a password based key using PBKDF - secret key generation parameters will be passed separately.
PBKDF2Key(char[] password, CharToByteConverter converter, AlgorithmIdentifier prf)
          Constructor for a password based key using PBKDF2 with a given PRF - secret key generation parameters will be passed separately.
 
Method Summary
 java.lang.String getAlgorithm()
          Return the password based key derivation function this key is for,
 byte[] getEncoded()
          Return the password converted to bytes.
 java.lang.String getFormat()
          Return the format encoding.
 char[] getPassword()
          Return a reference to the char[] array holding the password.
 AlgorithmIdentifier getPrf()
          Return the PRF to use with PBKDF2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBKDF2Key

public PBKDF2Key(char[] password,
                 CharToByteConverter converter)
Basic constructor for a password based key using PBKDF - secret key generation parameters will be passed separately. No PRF is recorded, so a cipher deriving a key from this one uses HMAC-SHA512.

Parameters:
password - password to use.
converter - converter to use for turning the password into bytes.

PBKDF2Key

public PBKDF2Key(char[] password,
                 CharToByteConverter converter,
                 AlgorithmIdentifier prf)
Constructor for a password based key using PBKDF2 with a given PRF - secret key generation parameters will be passed separately.

Parameters:
password - password to use.
converter - converter to use for turning the password into bytes.
prf - the PRF to use with PBKDF2, null if none is specified.
Method Detail

getPrf

public AlgorithmIdentifier getPrf()
Return the PRF to use with PBKDF2.

Returns:
the PRF's AlgorithmIdentifier, null if none was specified.

getPassword

public char[] getPassword()
Return a reference to the char[] array holding the password.

Returns:
a reference to the password array.

getAlgorithm

public java.lang.String getAlgorithm()
Return the password based key derivation function this key is for,

Specified by:
getAlgorithm in interface java.security.Key
Returns:
the string "PBKDF2"

getFormat

public java.lang.String getFormat()
Return the format encoding.

Specified by:
getFormat in interface java.security.Key
Returns:
the type name representing a char[] to byte[] conversion.

getEncoded

public byte[] getEncoded()
Return the password converted to bytes.

Specified by:
getEncoded in interface java.security.Key
Returns:
the password converted to a byte array.

Bouncy Castle Cryptography Library 1.87