public class PBES2Parameters
extends java.security.AlgorithmParametersSpi
-- PBES2
PBES2Algorithms ALGORITHM-IDENTIFIER ::=
{ {PBES2-params IDENTIFIED BY id-PBES2}, ...}
id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13}
PBES2-params ::= SEQUENCE {
keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},
encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} }
PBES2-KDFs ALGORITHM-IDENTIFIER ::=
{ {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ... }
PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... }
-- PBKDF2
PBKDF2Algorithms ALGORITHM-IDENTIFIER ::=
{ {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ...}
id-PBKDF2 OBJECT IDENTIFIER ::= {pkcs-5 12}
PBKDF2-params ::= SEQUENCE {
salt CHOICE {
specified OCTET STRING,
otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}
},
iterationCount INTEGER (1..MAX),
keyLength INTEGER (1..MAX) OPTIONAL,
prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1
}
PBKDF2-SaltSources ALGORITHM-IDENTIFIER ::= { ... }
PBKDF2-PRFs ALGORITHM-IDENTIFIER ::= {
{NULL IDENTIFIED BY id-hmacWithSHA1} |
{NULL IDENTIFIED BY id-hmacWithSHA224} |
{NULL IDENTIFIED BY id-hmacWithSHA256} |
{NULL IDENTIFIED BY id-hmacWithSHA384} |
{NULL IDENTIFIED BY id-hmacWithSHA512}, ... }
algid-hmacWithSHA1 AlgorithmIdentifier {{PBKDF2-PRFs}} ::=
{algorithm id-hmacWithSHA1, parameters NULL : NULL}
id-hmacWithSHA1 OBJECT IDENTIFIER ::= {digestAlgorithm 7}
PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... }
| Constructor and Description |
|---|
PBES2Parameters()
The default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
engineGetEncoded()
Returns the parameters as DER byte array.
|
protected byte[] |
engineGetEncoded(java.lang.String format)
Returns the parameters as a DER byte array.
|
protected java.security.spec.AlgorithmParameterSpec |
engineGetParameterSpec(java.lang.Class paramSpec)
Returns the PBES2 parameters as transparent PBES2 parameter specification of
the given class type.
|
protected void |
engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
Initializes this PBES2Parameters with salt and iteration count from a given
PBES2KeyAndParameterSpec.
|
protected void |
engineInit(byte[] params)
Initializes this PBES2Parameters object from the given DER encoded byte
array.
|
protected void |
engineInit(byte[] params,
java.lang.String format)
Inits the parameters from an DER encoded byte array.
|
protected java.lang.String |
engineToString()
Returns a String representation of the parameters.
|
protected AlgorithmID |
getEncryptionScheme() |
protected int |
getIterationCount() |
protected AlgorithmID |
getKD() |
protected AlgorithmID |
getPRF() |
protected byte[] |
getSalt() |
ASN1Object |
toASN1Object() |
public PBES2Parameters()
PBES2Parameters object. Applications shall use one of the
AlgorithmParameters.getInstance factory methods for obtaining
PBES2Parameters.protected byte[] engineGetEncoded()
throws java.io.IOException
A SEQUENCE ASN.1 object is created for holding salt, iteration
count, derived key length (optional) and the pseudorandom function;
subsequently this SEQUENCE object is DER-encoded to get the required byte
array.
PBES2-params ::= SEQUENCE {
keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}},
encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} }
PBKDF2-params ::= SEQUENCE {
salt CHOICE
{
specified OCTET STRING,
otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}
},
iterationCount INTEGER (1000..MAX),
keyLength INTEGER (32..MAX) OPTIONAL,
prf AlgorithmIdentifier {{PBKDF2-PRFs}}
}
- salt contains the random value S in OCTET STRING.
- iterationCount specifies the iteration count c.
- keyLength is the length of the derived key in octets. It is optional field for PBES2 sheme since it is always 32 octets.
- prf identifies the pseudorandom function.
engineGetEncoded in class java.security.AlgorithmParametersSpijava.io.IOException - if an encoding error occursprotected byte[] engineGetEncoded(java.lang.String format)
throws java.io.IOException
Format is ignored. Only DER encoding is supported at this time. This method
only calls engineGetEncoded() for returning the
PBES2 paramters as DER encoded byte array, regardless of what is specified in
the format string.
engineGetEncoded in class java.security.AlgorithmParametersSpiformat - the encoding format; ignoredjava.io.IOException - if an encoding error occursprotected java.security.spec.AlgorithmParameterSpec engineGetParameterSpec(java.lang.Class paramSpec)
throws java.security.spec.InvalidParameterSpecException
engineGetParameterSpec in class java.security.AlgorithmParametersSpiparamSpec - the desired parameter specification classjava.security.spec.InvalidParameterSpecException - if the paramters cannot be converted
to the desired parameter
specificationprotected void engineInit(java.security.spec.AlgorithmParameterSpec paramSpec)
throws java.security.spec.InvalidParameterSpecException
engineInit in class java.security.AlgorithmParametersSpiparamSpec - the parameter specification, which has to be a
PBES2KeyAndParameterSpecjava.security.spec.InvalidParameterSpecException - if the given parameter specification
is not a PBEParameterSpecprotected void engineInit(byte[] params)
throws java.io.IOException
From the given byte array a ASN.1 object is created to be parsed for the required salt, iteration count, derived key length (optional) and the pseudorandom function.
engineInit in class java.security.AlgorithmParametersSpiparams - the DER encoded byte arrayjava.io.IOException - if an error occurs when decoding the given byte arraypublic ASN1Object toASN1Object()
protected byte[] getSalt()
protected int getIterationCount()
protected AlgorithmID getKD()
protected AlgorithmID getPRF()
protected AlgorithmID getEncryptionScheme()
protected void engineInit(byte[] params,
java.lang.String format)
throws java.io.IOException
engineInit(params) for initializing this PBEParamters
object from the given DER encoded byte array, regardless of what is specified
in the format string.engineInit in class java.security.AlgorithmParametersSpiparams - the DER encoded byte arrayformat - the encoding format; ignoredjava.io.IOException - if an error occurs when decoding the given byte arrayprotected java.lang.String engineToString()
engineToString in class java.security.AlgorithmParametersSpi