Top Description Fields Constructors Methods
org.bouncycastle.crypto

public abstract Class PBEParametersGenerator

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator, org.bouncycastle.crypto.generators.PKCS12ParametersGenerator, org.bouncycastle.crypto.generators.PKCS5S1ParametersGenerator, org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator, org.bouncycastle.jce.provider.OldPKCS12ParametersGenerator
Imports
org.bouncycastle.util.Strings

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

Field Summary

Modifier and TypeField and Description
protected int
protected byte[]
protected byte[]

Constructor Summary

AccessConstructor and Description
protected
PBEParametersGenerator()

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 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
passwordback to summary
protected byte[] password
saltback to summary
protected byte[] salt

Constructor Detail

PBEParametersGeneratorback to summary
protected PBEParametersGenerator()

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.

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.