de.flexiprovider.core.rsa
Class RSAOAEPParameters

java.lang.Object
  |
  +--java.security.AlgorithmParametersSpi
        |
        +--de.flexiprovider.api.parameters.AlgorithmParameters
              |
              +--de.flexiprovider.core.rsa.RSAOAEPParameters

public class RSAOAEPParameters
extends AlgorithmParameters

This class provides ASN.1 encoding and decoding of parameters for RSA-OAEP (specified by RSAOAEPParameterSpec).

Author:
Martin Döring

Constructor Summary
RSAOAEPParameters()
           
 
Method Summary
 byte[] getEncoded()
          Encode the parameters according to the primary encoding format (ASN.1).
 byte[] getEncoded(java.lang.String format)
          Encode the parameters according to the specified encoding format.
 AlgorithmParameterSpec getParameterSpec(java.lang.Class paramSpec)
          Return a transparent specification of the parameters.
 void init(AlgorithmParameterSpec paramSpec)
          Initialize the parameters with the given parameter specification.
 void init(byte[] encParams)
          Import the given encoded parameters and decode them according to the primary encoding format (ASN.1).
 void init(byte[] encParams, java.lang.String format)
          Import the given encoded parameters and decode them according to the specified encoding format.
 java.lang.String toString()
           
 
Methods inherited from class de.flexiprovider.api.parameters.AlgorithmParameters
engineGetEncoded, engineGetEncoded, engineGetParameterSpec, engineInit, engineInit, engineInit, engineToString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RSAOAEPParameters

public RSAOAEPParameters()
Method Detail

init

public void init(AlgorithmParameterSpec paramSpec)
          throws InvalidParameterSpecException
Initialize the parameters with the given parameter specification. Currently, only parameter specifications of type RSAOAEPParameterSpec are supported.
Overrides:
init in class AlgorithmParameters
Parameters:
paramSpec - the parameter specification
Throws:
InvalidParameterSpecException - if the parameter specification is null or nor an instance of RSAOAEPParameterSpec.

init

public void init(byte[] encParams)
          throws java.io.IOException
Import the given encoded parameters and decode them according to the primary encoding format (ASN.1).
Overrides:
init in class AlgorithmParameters
Parameters:
encParams - the encoded parameters
Throws:
java.io.IOException - on decoding errors.

init

public void init(byte[] encParams,
                 java.lang.String format)
          throws java.io.IOException
Import the given encoded parameters and decode them according to the specified encoding format. Currently, only the primary encoding format (ASN.1) is supported.
Overrides:
init in class AlgorithmParameters
Parameters:
encParams - the encoded parameters
format - the encoding format
Throws:
java.io.IOException - on decoding errors or if the encoding format is null or not equals to "ASN.1".

getEncoded

public byte[] getEncoded()
                  throws java.io.IOException
Encode the parameters according to the primary encoding format (ASN.1).

The ASN.1 definition of the parameters structure is

 RSAES-OAEP-params ::= SEQUENCE {
   md       AlgorithmIdentifier,
   mgf      AlgorithmIdentifier,
   pSource  AlgorithmIdentifier,
 }
 
Overrides:
getEncoded in class AlgorithmParameters
Returns:
the encoded parameters
Throws:
java.io.IOException - on encoding errors.

getEncoded

public byte[] getEncoded(java.lang.String format)
                  throws java.io.IOException
Encode the parameters according to the specified encoding format. Currently, only the primary encoding format (ASN.1) is supported.
Overrides:
getEncoded in class AlgorithmParameters
Parameters:
format - the encoding format
Returns:
the encoded parameters
Throws:
java.io.IOException - on encoding errors or if the encoding format is null or not equals to "ASN.1".

getParameterSpec

public AlgorithmParameterSpec getParameterSpec(java.lang.Class paramSpec)
                                        throws InvalidParameterSpecException
Return a transparent specification of the parameters. Currently, only RSAOAEPParameterSpec is supported as parameter specification type.
Overrides:
getParameterSpec in class AlgorithmParameters
Parameters:
paramSpec - the desired parameter specification type
Returns:
the parameter specification
Throws:
InvalidParameterSpecException - if the parameter specification type is null or not assignable from RSAOAEPParameterSpec.

toString

public java.lang.String toString()
Overrides:
toString in class AlgorithmParameters
Returns:
a human readable form of the parameters