Top Description Fields Constructors Methods
org.bouncycastle.jce.provider

pack-priv Class OldPKCS12ParametersGenerator

Located in compilation unit of org.bouncycastle.jce.provider.BrokenPBE.

extends PBEParametersGenerator
Class Inheritance

Generator for PBE derived keys and ivs as defined by PKCS 12 V1.0, with a bug affecting 180 bit plus keys - this class is only here to allow smooth migration of the version 0 keystore to version 1. Don't use it (it won't be staying around).

The document this implementation is based on can be found at RSA's PKCS12 Page

Field Summary

Modifier and TypeField and Description
private Digest
public static final int
public static final int
public static final int
private int
u

private int
v

Inherited from org.bouncycastle.crypto.PBEParametersGenerator:
iterationCountpasswordsalt

Constructor Summary

AccessConstructor and Description
public
OldPKCS12ParametersGenerator(Digest
the digest to be used as the source of derived keys.
digest
)

Construct a PKCS 12 Parameters generator.

Method Summary

Modifier and TypeMethod and Description
private void
adjust(byte[] a, int aOff, byte[] b)

add a + b + 1, returning the result in a.

private byte[]
generateDerivedKey(int idByte, int n)

generation of a derived key ala PKCS12 V1.0.

public CipherParameters

Returns:

a KeyParameter object.
generateDerivedMacParameters
(int
the size of the key we want (in bits)
keySize
)

Implements abstract org.bouncycastle.crypto.PBEParametersGenerator.generateDerivedMacParameters.

Generate a key parameter for use with a MAC derived from the password, salt, and iteration count we are currently initialised with.
public CipherParameters

Returns:

a KeyParameter object.
generateDerivedParameters
(int
the size of the key we want (in bits)
keySize
)

Implements abstract org.bouncycastle.crypto.PBEParametersGenerator.generateDerivedParameters.

Generate a key parameter derived from the password, salt, and iteration count we are currently initialised with.
public CipherParameters

Returns:

a ParametersWithIV object.
generateDerivedParameters
(int
the size of the key we want (in bits)
keySize
,
int
the size of the iv we want (in bits)
ivSize
)

Implements abstract org.bouncycastle.crypto.PBEParametersGenerator.generateDerivedParameters.

Generate a key with initialisation vector parameter derived from the password, salt, and iteration count we are currently initialised with.
Inherited from org.bouncycastle.crypto.PBEParametersGenerator:
getIterationCountgetPasswordgetSaltinitPKCS12PasswordToBytesPKCS5PasswordToBytesPKCS5PasswordToUTF8Bytes

Field Detail

digestback to summary
private Digest digest
IV_MATERIALback to summary
public static final int IV_MATERIAL
KEY_MATERIALback to summary
public static final int KEY_MATERIAL
MAC_MATERIALback to summary
public static final int MAC_MATERIAL
uback to summary
private int u
vback to summary
private int v

Constructor Detail

OldPKCS12ParametersGeneratorback to summary
public OldPKCS12ParametersGenerator(Digest digest)

Construct a PKCS 12 Parameters generator. This constructor will accept MD5, SHA1, and RIPEMD160.

Parameters
digest:Digest

the digest to be used as the source of derived keys.

Exceptions
IllegalArgumentException:
if an unknown digest is passed in.

Method Detail

adjustback to summary
private void adjust(byte[] a, int aOff, byte[] b)

add a + b + 1, returning the result in a. The a value is treated as a BigInteger of length (b.length * 8) bits. The result is modulo 2^b.length in case of overflow.

generateDerivedKeyback to summary
private byte[] generateDerivedKey(int idByte, int n)

generation of a derived key ala PKCS12 V1.0.

generateDerivedMacParametersback to summary
public CipherParameters generateDerivedMacParameters(int keySize)

Implements abstract org.bouncycastle.crypto.PBEParametersGenerator.generateDerivedMacParameters.

Generate a key parameter for use with a MAC derived from the password, salt, and iteration count we are currently initialised with.

Parameters
keySize:int

the size of the key we want (in bits)

Returns:CipherParameters

a KeyParameter object.

generateDerivedParametersback to summary
public CipherParameters generateDerivedParameters(int keySize)

Implements abstract org.bouncycastle.crypto.PBEParametersGenerator.generateDerivedParameters.

Generate a key parameter derived from the password, salt, and iteration count we are currently initialised with.

Parameters
keySize:int

the size of the key we want (in bits)

Returns:CipherParameters

a KeyParameter object.

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

Implements abstract org.bouncycastle.crypto.PBEParametersGenerator.generateDerivedParameters.

Generate a key with initialisation vector parameter derived from the password, salt, and iteration count we are currently initialised with.

Parameters
keySize:int

the size of the key we want (in bits)

ivSize:int

the size of the iv we want (in bits)

Returns:CipherParameters

a ParametersWithIV object.