Top Description Fields Constructors Methods
org.bouncycastle.crypto.internal

public abstract Class PBEParametersGenerator<T extends Parameters>

extends Object
implements PasswordBasedDeriver<T extends Parameters>
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.PasswordBasedDeriver
Known Direct Subclasses
org.bouncycastle.crypto.fips.PKCS5S2ParametersGenerator, org.bouncycastle.crypto.general.OpenSSLPBEParametersGenerator, org.bouncycastle.crypto.general.PKCS12ParametersGenerator, org.bouncycastle.crypto.general.PKCS5S1ParametersGenerator, org.bouncycastle.crypto.general.PKCS5S2ParametersGenerator
Imports
org.bouncycastle.crypto.Parameters, .PasswordBasedDeriver, org.bouncycastle.util.Strings

super class for all Password Based Encryption (PBE) parameter generator classes.

Field Summary

Modifier and TypeField and Description
protected int
private final T
protected byte[]
protected byte[]

Constructor Summary

AccessConstructor and Description
protected
PBEParametersGenerator(T parameters)

base constructor.

Method Summary

Modifier and TypeMethod and Description
public abstract CipherParameters

Returns:

a parameters object representing a key.
generateDerivedMacParameters
(int
the length, in bits, of the key required.
keySize
)

generate derived parameters for a key of length keySize, specifically for use with a MAC.

public abstract CipherParameters

Returns:

a parameters object representing a key.
generateDerivedParameters
(int
the length, in bits, of the key required.
keySize
)

generate derived parameters for a key of length keySize.

public abstract CipherParameters

Returns:

a parameters object representing a key and an IV.
generateDerivedParameters
(int
the length, in bits, of the key required.
keySize
,
int
the length, in bits, of the iv required.
ivSize
)

generate derived parameters for a key of length keySize, and an initialisation vector (IV) of length ivSize.

public int

Returns:

the iteration count.
getIterationCount
()

return the iteration count.

public T
getParameters()

Implements org.bouncycastle.crypto.PasswordBasedDeriver.getParameters.

Return the parameters for this deriver.
public byte[]

Returns:

the password byte array.
getPassword
()

return the password byte array.

public byte[]

Returns:

the salt byte array.
getSalt
()

return the salt byte array.

public void
init(byte[]
the password converted into bytes (see below).
password
,
byte[]
the salt to be mixed with the password.
salt
,
int
the number of iterations the "mixing" function is to be applied for.
iterationCount
)

initialise the PBE generator.

public static byte[]

Returns:

a byte array representing the password.
PKCS12PasswordToBytes
(char[]
a character array representing the password.
password
)

converts a password to a byte array according to the scheme in PKCS12 (unicode, big endian, 2 zero pad bytes at the end).

public static byte[]

Returns:

a byte array representing the password.
PKCS5PasswordToBytes
(char[]
a character array representing the password.
password
)

converts a password to a byte array according to the scheme in PKCS5 (ascii, no padding)

public static byte[]

Returns:

a byte array representing the password.
PKCS5PasswordToUTF8Bytes
(char[]
a character array representing the password.
password
)

converts a password to a byte array according to the scheme in PKCS5 (UTF-8, no padding)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iterationCountback to summary
protected int iterationCount
parametersback to summary
private final T parameters
passwordback to summary
protected byte[] password
saltback to summary
protected byte[] salt

Constructor Detail

PBEParametersGeneratorback to summary
protected PBEParametersGenerator(T parameters)

base constructor.

Method Detail

generateDerivedMacParametersback to summary
public abstract CipherParameters generateDerivedMacParameters(int keySize)

generate derived parameters for a key of length keySize, specifically for use with a MAC.

Parameters
keySize:int

the length, in bits, of the key required.

Returns:CipherParameters

a parameters object representing a key.

generateDerivedParametersback to summary
public abstract CipherParameters generateDerivedParameters(int keySize)

generate derived parameters for a key of length keySize.

Parameters
keySize:int

the length, in bits, of the key required.

Returns:CipherParameters

a parameters object representing a key.

generateDerivedParametersback to summary
public abstract CipherParameters generateDerivedParameters(int keySize, int ivSize)

generate derived parameters for a key of length keySize, and an initialisation vector (IV) of length ivSize.

Parameters
keySize:int

the length, in bits, of the key required.

ivSize:int

the length, in bits, of the iv required.

Returns:CipherParameters

a parameters object representing a key and an IV.

getIterationCountback to summary
public int getIterationCount()

return the iteration count.

Returns:int

the iteration count.

getParametersback to summary
public T getParameters()

Implements org.bouncycastle.crypto.PasswordBasedDeriver.getParameters.

Doc from org.bouncycastle.crypto.PasswordBasedDeriver.getParameters.

Return the parameters for this deriver.

Returns:T

the deriver's parameters.

getPasswordback to summary
public byte[] getPassword()

return the password byte array.

Returns:byte[]

the password byte array.

getSaltback to summary
public byte[] getSalt()

return the salt byte array.

Returns:byte[]

the salt byte array.

initback to summary
public void init(byte[] password, byte[] salt, int iterationCount)

initialise the PBE generator.

Parameters
password:byte[]

the password converted into bytes (see below).

salt:byte[]

the salt to be mixed with the password.

iterationCount:int

the number of iterations the "mixing" function is to be applied for.

PKCS12PasswordToBytesback to summary
public static byte[] PKCS12PasswordToBytes(char[] password)

converts a password to a byte array according to the scheme in PKCS12 (unicode, big endian, 2 zero pad bytes at the end).

Parameters
password:char[]

a character array representing the password.

Returns:byte[]

a byte array representing the password.

PKCS5PasswordToBytesback to summary
public static byte[] PKCS5PasswordToBytes(char[] password)

converts a password to a byte array according to the scheme in PKCS5 (ascii, no padding)

Parameters
password:char[]

a character array representing the password.

Returns:byte[]

a byte array representing the password.

PKCS5PasswordToUTF8Bytesback to summary
public static byte[] PKCS5PasswordToUTF8Bytes(char[] password)

converts a password to a byte array according to the scheme in PKCS5 (UTF-8, no padding)

Parameters
password:char[]

a character array representing the password.

Returns:byte[]

a byte array representing the password.