org.bouncycastle.crypto
Class PBEParametersGenerator
java.lang.Object
org.bouncycastle.crypto.PBEParametersGenerator
public abstract class PBEParametersGenerator
extends java.lang.Object
super class for all Password Based Encryption (PBE) parameter generator classes.
iterationCount
protected int iterationCount
password
protected byte[] password
salt
protected byte[] salt
PBEParametersGenerator
protected PBEParametersGenerator()
base constructor.
PKCS12PasswordToBytes
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).
password
- a character array reqpresenting the password.
- a byte array representing the password.
PKCS5PasswordToBytes
public static byte[] PKCS5PasswordToBytes(char[] password)
converts a password to a byte array according to the scheme in
PKCS5 (ascii, no padding)
password
- a character array reqpresenting the password.
- a byte array representing the password.
generateDerivedMacParameters
public CipherParameters generateDerivedMacParameters(int keySize)
generate derived parameters for a key of length keySize, specifically
for use with a MAC.
keySize
- the length, in bits, of the key required.
- a parameters object representing a key.
generateDerivedParameters
public CipherParameters generateDerivedParameters(int keySize)
generate derived parameters for a key of length keySize.
keySize
- the length, in bits, of the key required.
- a parameters object representing a key.
generateDerivedParameters
public CipherParameters generateDerivedParameters(int keySize,
int ivSize)
generate derived parameters for a key of length keySize, and
an initialisation vector (IV) of length ivSize.
keySize
- the length, in bits, of the key required.ivSize
- the length, in bits, of the iv required.
- a parameters object representing a key and an IV.
getIterationCount
public int getIterationCount()
return the iteration count.
- the iteration count.
getPassword
public byte[] getPassword()
return the password byte array.
- the password byte array.
getSalt
public byte[] getSalt()
return the salt byte array.
- the salt byte array.
init
public void init(byte[] password,
byte[] salt,
int iterationCount)
initialise the PBE generator.
password
- the password converted into bytes (see below).salt
- the salt to be mixed with the password.iterationCount
- the number of iterations the "mixing" function
is to be applied for.