Top Description Fields Constructors Methods
org.bouncycastle.jcajce

public Class PKCS12Key

extends Object
implements PBKDFKey
Class Inheritance
All Implemented Interfaces
org.bouncycastle.jcajce.PBKDFKey, javax.crypto.SecretKey, javax.security.auth.Destroyable, java.security.Key, java.io.Serializable
Known Direct Subclasses
org.bouncycastle.jcajce.PKCS12KeyWithParameters
Imports
org.bouncycastle.crypto.PasswordConverter

A password based key for use with PKCS#12.

Field Summary

Modifier and TypeField and Description
private final char[]
private final boolean

Constructor Summary

AccessConstructor and Description
public
PKCS12Key(char[]
password to use.
password
)

Basic constructor for a password based key - secret key generation parameters will be passed separately..

public
PKCS12Key(char[]
password to use.
password
,
boolean
use the incorrect encoding approach (add pad bytes)
useWrongZeroLengthConversion
)

Unfortunately there seems to be some confusion about how to handle zero length passwords.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the string "PKCS12"
getAlgorithm
()

Implements java.security.Key.getAlgorithm.

Return the password based key derivation function this key is for,
public byte[]

Returns:

the password converted to a byte array.
getEncoded
()

Implements java.security.Key.getEncoded.

Return the password converted to bytes.
public String

Returns:

the string "PKCS12", representing the char[] to byte[] conversion.
getFormat
()

Implements java.security.Key.getFormat.

Return the format encoding.
public char[]

Returns:

a reference to the password array.
getPassword
()

Return a reference to the char[] array holding the password.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

passwordback to summary
private final char[] password
useWrongZeroLengthConversionback to summary
private final boolean useWrongZeroLengthConversion

Constructor Detail

PKCS12Keyback to summary
public PKCS12Key(char[] password)

Basic constructor for a password based key - secret key generation parameters will be passed separately..

Parameters
password:char[]

password to use.

PKCS12Keyback to summary
public PKCS12Key(char[] password, boolean useWrongZeroLengthConversion)

Unfortunately there seems to be some confusion about how to handle zero length passwords.

Parameters
password:char[]

password to use.

useWrongZeroLengthConversion:boolean

use the incorrect encoding approach (add pad bytes)

Method Detail

getAlgorithmback to summary
public String getAlgorithm()

Implements java.security.Key.getAlgorithm.

Return the password based key derivation function this key is for,

Returns:String

the string "PKCS12"

getEncodedback to summary
public byte[] getEncoded()

Implements java.security.Key.getEncoded.

Return the password converted to bytes.

Returns:byte[]

the password converted to a byte array.

getFormatback to summary
public String getFormat()

Implements java.security.Key.getFormat.

Return the format encoding.

Returns:String

the string "PKCS12", representing the char[] to byte[] conversion.

getPasswordback to summary
public char[] getPassword()

Return a reference to the char[] array holding the password.

Returns:char[]

a reference to the password array.