Class PBEParametersGenerator
- java.lang.Object
-
- com.ongres.scram.common.bouncycastle.pbkdf2.PBEParametersGenerator
-
- Direct Known Subclasses:
PKCS5S2ParametersGenerator
public abstract class PBEParametersGenerator extends Object
super class for all Password Based Encryption (PBE) parameter generator classes.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
iterationCount
protected byte[]
password
protected byte[]
salt
-
Constructor Summary
Constructors Modifier Constructor Description protected
PBEParametersGenerator()
base constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract CipherParameters
generateDerivedParameters(int keySize)
generate derived parameters for a key of length keySize.int
getIterationCount()
return the iteration count.byte[]
getPassword()
return the password byte array.byte[]
getSalt()
return the salt byte array.void
init(byte[] password, byte[] salt, int iterationCount)
initialise the PBE generator.static byte[]
PKCS5PasswordToUTF8Bytes(char[] password)
converts a password to a byte array according to the scheme in PKCS5 (UTF-8, no padding)
-
-
-
Method Detail
-
init
public void init(byte[] password, byte[] salt, int iterationCount)
initialise the PBE generator.- Parameters:
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.
-
getPassword
public byte[] getPassword()
return the password byte array.- Returns:
- the password byte array.
-
getSalt
public byte[] getSalt()
return the salt byte array.- Returns:
- the salt byte array.
-
getIterationCount
public int getIterationCount()
return the iteration count.- Returns:
- the iteration count.
-
generateDerivedParameters
public abstract CipherParameters generateDerivedParameters(int keySize)
generate derived parameters for a key of length keySize.- Parameters:
keySize
- the length, in bits, of the key required.- Returns:
- a parameters object representing a key.
-
PKCS5PasswordToUTF8Bytes
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
- a character array representing the password.- Returns:
- a byte array representing the password.
-
-