Package org.conscrypt

Class OAEPParameters


  • @Internal
    public class OAEPParameters
    extends java.security.AlgorithmParametersSpi
    AlgorithmParameters implementation for OAEP. The only supported encoding format is ASN.1, as specified in RFC 4055 section 4.1.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String MGF1_OID  
      private static java.util.Map<java.lang.String,​java.lang.String> NAME_TO_OID  
      private static java.util.Map<java.lang.String,​java.lang.String> OID_TO_NAME  
      private static java.lang.String PSPECIFIED_OID  
      private javax.crypto.spec.OAEPParameterSpec spec  
    • Constructor Summary

      Constructors 
      Constructor Description
      OAEPParameters()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected byte[] engineGetEncoded()  
      protected byte[] engineGetEncoded​(java.lang.String format)  
      protected <T extends java.security.spec.AlgorithmParameterSpec>
      T
      engineGetParameterSpec​(java.lang.Class<T> aClass)  
      protected void engineInit​(byte[] bytes)  
      protected void engineInit​(byte[] bytes, java.lang.String format)  
      protected void engineInit​(java.security.spec.AlgorithmParameterSpec algorithmParameterSpec)  
      protected java.lang.String engineToString()  
      private static java.lang.String getHashName​(long hashRef)  
      (package private) static java.lang.String readHash​(long seqRef)  
      (package private) static java.lang.String readMgfHash​(long seqRef)  
      private static long writeAlgorithmIdentifier​(long container, java.lang.String oid)
      Writes an ASN.1 AlgorithmIdentifier structure into container, which looks like
      (package private) static void writeHashAndMgfHash​(long seqRef, java.lang.String hash, java.security.spec.MGF1ParameterSpec mgfSpec)  
      • Methods inherited from class java.lang.Object

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

      • OID_TO_NAME

        private static final java.util.Map<java.lang.String,​java.lang.String> OID_TO_NAME
      • NAME_TO_OID

        private static final java.util.Map<java.lang.String,​java.lang.String> NAME_TO_OID
      • spec

        private javax.crypto.spec.OAEPParameterSpec spec
    • Constructor Detail

      • OAEPParameters

        public OAEPParameters()
    • Method Detail

      • engineInit

        protected void engineInit​(java.security.spec.AlgorithmParameterSpec algorithmParameterSpec)
                           throws java.security.spec.InvalidParameterSpecException
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Throws:
        java.security.spec.InvalidParameterSpecException
      • engineInit

        protected void engineInit​(byte[] bytes)
                           throws java.io.IOException
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Throws:
        java.io.IOException
      • engineInit

        protected void engineInit​(byte[] bytes,
                                  java.lang.String format)
                           throws java.io.IOException
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Throws:
        java.io.IOException
      • readHash

        static java.lang.String readHash​(long seqRef)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • readMgfHash

        static java.lang.String readMgfHash​(long seqRef)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getHashName

        private static java.lang.String getHashName​(long hashRef)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • engineGetParameterSpec

        protected <T extends java.security.spec.AlgorithmParameterSpec> T engineGetParameterSpec​(java.lang.Class<T> aClass)
                                                                                          throws java.security.spec.InvalidParameterSpecException
        Specified by:
        engineGetParameterSpec in class java.security.AlgorithmParametersSpi
        Throws:
        java.security.spec.InvalidParameterSpecException
      • engineGetEncoded

        protected byte[] engineGetEncoded()
                                   throws java.io.IOException
        Specified by:
        engineGetEncoded in class java.security.AlgorithmParametersSpi
        Throws:
        java.io.IOException
      • engineGetEncoded

        protected byte[] engineGetEncoded​(java.lang.String format)
                                   throws java.io.IOException
        Specified by:
        engineGetEncoded in class java.security.AlgorithmParametersSpi
        Throws:
        java.io.IOException
      • writeHashAndMgfHash

        static void writeHashAndMgfHash​(long seqRef,
                                        java.lang.String hash,
                                        java.security.spec.MGF1ParameterSpec mgfSpec)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeAlgorithmIdentifier

        private static long writeAlgorithmIdentifier​(long container,
                                                     java.lang.String oid)
                                              throws java.io.IOException
        Writes an ASN.1 AlgorithmIdentifier structure into container, which looks like
         SEQUENCE
           OBJECT IDENTIFIER
           PARAMS (based on the particular algorithm)
         
        This method returns a reference to the sequence such that the params may be added to it. The reference needs to be freed with asn1_write_free once it's used.
        Throws:
        java.io.IOException
      • engineToString

        protected java.lang.String engineToString()
        Specified by:
        engineToString in class java.security.AlgorithmParametersSpi