|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.AlgorithmParametersSpi | +--iaik.pkcs.pkcs1.PKCS1AlgorithmParameters | +--iaik.pkcs.pkcs1.MGF1Parameters
Algorithm parameters for the PKCS#1v2.1 MGF1
mask generation function.
According to PKCS#1v2.1 the only parameter used by MGF1 is the algorithm id of the hash algorithm (default SHA-1) to be used:
mgf1SHA1 MaskGenAlgorithm ::= { algorithm id-mgf1, parameters HashAlgorithm : sha1 }MGF1Parameters can be generated provider independently by calling one of the
AlgorithmParameters.getInstance
methods. Subsequently the new
AlgorithmParamters object must be initialized with a proper MGF1 parameter
specification or a DER encoded byte array, e.g.:
MGF1ParameterSpec paramSpec = ...; AlgorithmParameters params = AlgorithmParameters.getInstance("MGF1", "IAIK"); params.init(paramSpec);repectively:
byte[] encodedParams = ...; AlgorithmParameters params = AlgorithmParameters.getInstance("MGF1", "IAIK"); params.init(encodedParams);
For obtaining MGF1 parameters in transparent representation from an opaque
MGF1Paramters object, the getParameterSpec
method can be used;
for obtaining the parameters as DER encoded ASN.1 object, use
getEncoded
:
MGF1ParameterSpec paramSpec = (MGF1ParameterSpec)params.getParameterSpec(MGF1ParameterSpec.class);repectively
byte[] encodedParams = params.getEncoded();
MGF1ParameterSpec
,
AlgorithmParameters
Constructor Summary | |
MGF1Parameters()
Default constructor. |
Method Summary | |
void |
decode(ASN1Object asn1Params)
Initializes this MGF1Parameters object from the given ASN1Object. |
protected byte[] |
engineGetEncoded()
Returns the parameters as DER byte array. |
protected byte[] |
engineGetEncoded(String format)
Returns the parameters as a DER byte array. |
protected AlgorithmParameterSpec |
engineGetParameterSpec(Class paramSpec)
Returns the MGF1 parameters as transparent parameter specification of the given class type. |
protected void |
engineInit(AlgorithmParameterSpec paramSpec)
Initializes this MGF1Parameters from the given MGF1ParameterSpec. |
protected void |
engineInit(byte[] params)
Initializes this MGF1Parameters object from the given DER encoded byte array. |
protected void |
engineInit(byte[] params,
String format)
Inits the parameters from an DER encoded byte array. |
protected String |
engineToString()
Returns a String representation of this object. |
ASN1Object |
toASN1Object()
Gets an ASN.1 representation of this MGF1 parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MGF1Parameters()
MGF1Parameters
object.
Applications shall use one of the AlgorithmParameters.getInstance
factory methods for obtaining MGF1Parameters.Method Detail |
protected byte[] engineGetEncoded() throws IOException
engineGetEncoded
in class AlgorithmParametersSpi
IOException
- if an encoding error occursprotected byte[] engineGetEncoded(String format) throws IOException
Format is ignored. Only DER encoding is supported at this time. This method
only calls engineGetEncoded()
, regardless of what
is specified in the format
string.
engineGetEncoded
in class AlgorithmParametersSpi
format
- the encoding format; ignoredIOException
- if an encoding error occurspublic ASN1Object toASN1Object()
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec) throws InvalidParameterSpecException
engineGetParameterSpec
in class AlgorithmParametersSpi
paramSpec
- the desired parameter specification class (MGF1ParameterSpec)InvalidParameterSpecException
- if the paramters cannot be converted to
the desired parameter specificationprotected void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException
engineInit
in class AlgorithmParametersSpi
paramSpec
- the parameter specification, which has to be a MGF1ParameterSpecInvalidParameterSpecException
- if the given parameter specification
is not a or is an invalid MGF1ParameterSpecprotected void engineInit(byte[] params) throws IOException
engineInit
in class AlgorithmParametersSpi
params
- the DER encoded byte arrayIOException
- if an error occurs when decoding the given byte arraypublic void decode(ASN1Object asn1Params) throws CodingException
params
- the MGF1 parameters in ASN.1 representationCodingException
- if an error occurs when parsing the parametersprotected void engineInit(byte[] params, String format) throws IOException
engineInit(params)
for initializing this MGF1Parameters
object from the given DER encoded byte array, regardless of what is specified
in the format
string.
engineInit
in class AlgorithmParametersSpi
params
- the DER encoded byte arrayformat
- the encoding format; ignoredIOException
- if an error occurs when decoding the given byte arrayprotected String engineToString()
engineToString
in class AlgorithmParametersSpi
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |