Class OAEPParameters


  • public final class OAEPParameters
    extends java.security.AlgorithmParametersSpi
    This class implements the OAEP parameters used with the RSA algorithm in OAEP padding. Here is its ASN.1 definition:
     RSAES-OAEP-params ::= SEQUENCE {
     hashAlgorithm    [0] HashAlgorithm    DEFAULT sha1,
     maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
     pSourceAlgorithm [2] PSourceAlgorithm DEFAULT pSpecifiedEmpty
     }
    
     where
     HashAlgorithm ::= AlgorithmIdentifier {
       {OAEP-PSSDigestAlgorithms}
     }
     MaskGenAlgorithm ::= AlgorithmIdentifier {
       {PKCS1MGFAlgorithms}
     }
     OAEP-PSSDigestAlgorithms  ALGORITHM-IDENTIFIER ::= {
     { OID id-sha1   PARAMETERS NULL   }|
     { OID id-sha224 PARAMETERS NULL }|
     { OID id-sha256 PARAMETERS NULL }|
     { OID id-sha384 PARAMETERS NULL }|
     { OID id-sha512 PARAMETERS NULL },
     ...  -- Allows for future expansion --
     }
    
     PKCS1MGFAlgorithms  ALGORITHM-IDENTIFIER ::= {
     { OID id-mgf1 PARAMETERS HashAlgorithm },
     ...  -- Allows for future expansion --
     }
    
     
    The PSSParameterSpec class also has a member for storing mgf parameters.

    Note: the OAEPParameterSpec.DEFAULT uses the following:

         message digest  -- "SHA-1"
         mask generation function (mgf) -- "MGF1"
         parameters for mgf -- MGF1ParameterSpec.SHA1
         source of encoding input -- PSource.PSpecified.DEFAULT
     
    • Constructor Summary

      Constructors 
      Constructor Description
      OAEPParameters()
      Constructs a new instance of this class
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected byte[] engineGetEncoded()
      Returns the parameters in encoded bytes.
      protected byte[] engineGetEncoded​(java.lang.String encodingMethod)
      Returns the parameters in encoded bytes with encoding method specified.
      protected <T extends java.security.spec.AlgorithmParameterSpec>
      T
      engineGetParameterSpec​(java.lang.Class<T> paramSpec)
      Return the parameter spec used by this parameter instance.
      protected void engineInit​(byte[] encoded)
      Initialize the OAEPParameters by using encoded bytes.
      protected void engineInit​(byte[] encoded, java.lang.String decodingMethod)
      Initialize the OAEPParameters by encoded bytes with the specified decoding method.
      protected void engineInit​(java.security.spec.AlgorithmParameterSpec paramSpec)
      Initialize the OAEPParameters by use of a OAEPParameterSpec object.
      protected java.lang.String engineToString()
      Returns a human readable string describing the parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OAEPParameters

        public OAEPParameters()
        Constructs a new instance of this class
    • Method Detail

      • engineInit

        protected void engineInit​(java.security.spec.AlgorithmParameterSpec paramSpec)
                           throws java.security.spec.InvalidParameterSpecException
        Initialize the OAEPParameters by use of a OAEPParameterSpec object.
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Parameters:
        paramSpec - the OAEP algorithm parameter spec for this instance.
        Throws:
        java.security.spec.InvalidParameterSpecException - occurs when the paramSpec parameter is not an instance of OAEPParameterSpec.
      • engineInit

        protected void engineInit​(byte[] encoded)
                           throws java.io.IOException
        Initialize the OAEPParameters by using encoded bytes.
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Parameters:
        params - the encoded bytes of the parameters.
        Throws:
        java.io.IOException - occurs when the encoding can not be correctly decoded.
      • engineInit

        protected void engineInit​(byte[] encoded,
                                  java.lang.String decodingMethod)
                           throws java.io.IOException
        Initialize the OAEPParameters by encoded bytes with the specified decoding method.
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Parameters:
        params - the encoded bytes of the parameters.
        decodingMethod - the decoding method to be used (has no real function).
        Throws:
        java.io.IOException - occurs when the encoding can not be correctly decoded.
      • engineGetParameterSpec

        protected <T extends java.security.spec.AlgorithmParameterSpec> T engineGetParameterSpec​(java.lang.Class<T> paramSpec)
                                                                                          throws java.security.spec.InvalidParameterSpecException
        Return the parameter spec used by this parameter instance.
        Specified by:
        engineGetParameterSpec in class java.security.AlgorithmParametersSpi
        Parameters:
        paramSpec - the parameter spec class to be returned.
        Returns:
        AlgorithmParameterSpec the newly generated parameterSpec.
        Throws:
        java.security.spec.InvalidParameterSpecException - occurs when a OAEPParameterSpec object can not be created.
      • engineGetEncoded

        protected byte[] engineGetEncoded()
                                   throws java.io.IOException
        Returns the parameters in encoded bytes.
        Specified by:
        engineGetEncoded in class java.security.AlgorithmParametersSpi
        Returns:
        byte[] the encoded parameters.
        Throws:
        java.io.IOException - occurs if we have an IO problem.
      • engineGetEncoded

        protected byte[] engineGetEncoded​(java.lang.String encodingMethod)
                                   throws java.io.IOException
        Returns the parameters in encoded bytes with encoding method specified. This call does the samething as engineGetEncoded().
        Specified by:
        engineGetEncoded in class java.security.AlgorithmParametersSpi
        Parameters:
        encodingMethod - The parameter is not really used.
        Returns:
        byte[] encoded parameters.
        Throws:
        java.io.IOException - occurs if we have an IO problem.
      • engineToString

        protected java.lang.String engineToString()
        Returns a human readable string describing the parameters.
        Specified by:
        engineToString in class java.security.AlgorithmParametersSpi
        Returns:
        Returns a human readable string describing the parameters.