Bouncy Castle Cryptography Library 1.77.0

org.bouncycastle.jcajce
Class PKCS12Key

java.lang.Object
  |
  +--org.bouncycastle.jcajce.PKCS12Key
All Implemented Interfaces:
java.security.Key, PBKDFKey, javax.crypto.SecretKey, java.io.Serializable
Direct Known Subclasses:
PKCS12KeyWithParameters

public class PKCS12Key
extends java.lang.Object
implements PBKDFKey

A password based key for use with PKCS#12.

See Also:
Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
PKCS12Key(char[] password)
          Basic constructor for a password based key - secret key generation parameters will be passed separately..
PKCS12Key(char[] password, boolean useWrongZeroLengthConversion)
          Unfortunately there seems to be some confusion about how to handle zero length passwords.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS12Key

public PKCS12Key(char[] password)
Basic constructor for a password based key - secret key generation parameters will be passed separately..
Parameters:
password - password to use.

PKCS12Key

public PKCS12Key(char[] password,
                 boolean useWrongZeroLengthConversion)
Unfortunately there seems to be some confusion about how to handle zero length passwords.
Parameters:
password - password to use.
useWrongZeroLengthConversion - use the incorrect encoding approach (add pad bytes)
Method Detail

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 "PKCS12"

getFormat

public java.lang.String getFormat()
Return the format encoding.
Specified by:
getFormat in interface java.security.Key
Returns:
the string "PKCS12", representing the 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.77.0