iaik.pkcs.pkcs1
Class RSAOaepParameters

java.lang.Object
  |
  +--java.security.AlgorithmParametersSpi
        |
        +--iaik.pkcs.pkcs1.PKCS1AlgorithmParameters
              |
              +--iaik.pkcs.pkcs1.RSAOaepParameters

public class RSAOaepParameters
extends PKCS1AlgorithmParameters

Algorithm parameters for the PKCS#1 RSASES-OAEP encryption scheme.

PKCS#1v2.1 defines the following parameters for the OAEP signature scheme:

 RSASES-OAEP-params :: = SEQUENCE {
      hashAlgorithm            [0] HashAlgorithm     DEFAULT sha1,
      maskGenerationAlgorithm  [1] MaskGenAlgorithm  DEFAULT mgf1SHA1,
      pSourceAlgorithm         [2] PSourceAlgorithm  DEFAULT pSpecifiedEmpty,
 }

 HashAlgorithm ::= AlgorithmIdentifer { {OAEP-PSSDigestAlgorithms} }

 MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }

 PSourceAlgorithm ::= AlgorithmIdentifier { {PKCS1PSourceAlgorithms} }
 
By default OAEP uses SHA-1 as hash function, MGF1 (with SHA-1 as hash function parameter) as mask generation algorithm, and id-pSpecified as PSourceAlgorithm (with an empty OCTET STRING as parameter).

RSAOaepParamters can be generated provider independently by calling one of the AlgorithmParameters.getInstance methods. Subsequently the new AlgorithmParamters object must be initialized with a proper RSA-OAEP parameter specification or a DER encoded byte array, e.g.:

 RSAOaepParameterSpec oaepParamSpec = ...;
 AlgorithmParameters params = AlgorithmParameters.getInstance("RSAES-OAEP", "IAIK");
 params.init(oaepParamSpec);
 
repectively:
 byte[] encodedOaepParams = ...;
 AlgorithmParameters params = AlgorithmParameters.getInstance("RSAES-OAEP", "IAIK");
 params.init(encodedOaepParams);
 

For obtaining OAEP parameters in transparent representation from an opaque RSAOaepParamters object, the getParameterSpec method can be used; for obtaining the parameters as DER encoded ASN.1 object, use method getEncoded:

 RSAOaepParameterSpec oaepParamSpec = (RSAOaepParameterSpec)params.getParameterSpec(RSAOaepParameterSpec.class);
 
repectively
 byte[] encodedOaepParams = params.getEncoded();
 

Version:
File Revision 6
See Also:
RSAOaepParameterSpec, AlgorithmParameters

Constructor Summary
RSAOaepParameters()
          The default constructor.
 
Method Summary
 void decode(ASN1Object asn1Params)
          Initializes this RSAOaepParameters 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 RSA-OAEP parameters as transparent parameter specification of the given class type.
protected  void engineInit(AlgorithmParameterSpec paramSpec)
          Initializes this RSAOaepParameters from the given RSAOaepParameterSpec.
protected  void engineInit(byte[] params)
          Initializes this RSAOaepParameters 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 RSA OAEP parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSAOaepParameters

public RSAOaepParameters()
The default constructor. Only internally used for creating a RSAOaepParameters object. Applications shall use one of the AlgorithmParameters.getInstance factory methods for obtaining RSAOaepParameters.
Method Detail

engineGetEncoded

protected byte[] engineGetEncoded()
                           throws IOException
Returns the parameters as DER byte array.
Overrides:
engineGetEncoded in class AlgorithmParametersSpi
Returns:
the DER encoded parameters
Throws:
IOException - if an encoding error occurs

engineGetEncoded

protected byte[] engineGetEncoded(String format)
                           throws IOException
Returns the parameters as a DER byte array.

Format is ignored. Only DER encoding is supported. This method only calls engineGetEncoded(), regardless of what is specified in the format string.

Overrides:
engineGetEncoded in class AlgorithmParametersSpi
Parameters:
format - the encoding format; ignored
Returns:
the DER encoded parameters
Throws:
IOException - if an encoding error occurs

toASN1Object

public ASN1Object toASN1Object()
Gets an ASN.1 representation of this RSA OAEP parameters.
Returns:
this RSA OAEP parameters as ASN1Objet

engineGetParameterSpec

protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
                                                 throws InvalidParameterSpecException
Returns the RSA-OAEP parameters as transparent parameter specification of the given class type.
Overrides:
engineGetParameterSpec in class AlgorithmParametersSpi
Parameters:
paramSpec - the desired parameter specification class (RSAOaepParameterSpec)
Returns:
the parameters as RSAOaepParameterSpec
Throws:
InvalidParameterSpecException - if the paramters cannot be converted to the desired parameter specification

engineInit

protected void engineInit(AlgorithmParameterSpec paramSpec)
                   throws InvalidParameterSpecException
Initializes this RSAOaepParameters from the given RSAOaepParameterSpec.

Overrides:
engineInit in class AlgorithmParametersSpi
Parameters:
paramSpec - the parameter specification, which has to be a RSAOaepParameterSpec
Throws:
InvalidParameterSpecException - if the given parameter specification is not a or is an invalid RSAOaepParameterSpec

engineInit

protected void engineInit(byte[] params)
                   throws IOException
Initializes this RSAOaepParameters object from the given DER encoded byte array.
Overrides:
engineInit in class AlgorithmParametersSpi
Parameters:
params - the DER encoded byte array
Throws:
IOException - if an error occurs when decoding the given byte array

decode

public void decode(ASN1Object asn1Params)
            throws CodingException
Initializes this RSAOaepParameters object from the given ASN1Object.
Parameters:
params - the OAEP parameters in ASN.1 representation
Throws:
CodingException - if an error occurs when parsing the parameters

engineInit

protected void engineInit(byte[] params,
                          String format)
                   throws IOException
Inits the parameters from an DER encoded byte array. Format is ignored. Only calls {engineInit(params) for initializing this RSAOaepParameters object from the given DER encoded byte array, regardless of what is specified in the format string.

Overrides:
engineInit in class AlgorithmParametersSpi
Parameters:
params - the DER encoded byte array
format - the encoding format; ignored
Throws:
IOException - if an error occurs when decoding the given byte array

engineToString

protected String engineToString()
Returns a String representation of this object.
Overrides:
engineToString in class AlgorithmParametersSpi
Returns:
a String representation this object

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).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK