Class ECParameters


  • public final class ECParameters
    extends java.security.AlgorithmParametersSpi
    This class is used as an opaque representation of Elliptic Curve parameters and implements encoding and decoding of Elliptic Curve parameters as specified in RFC 3279. ASN.1 definition from RFC 3279. Note that X9.62 (2005) has added some additional options.
    
       
       EcpkParameters ::= CHOICE {
         ecParameters ECParameters,
         namedCurve   OBJECT IDENTIFIER,
         implicitlyCA NULL
       }
    
       ECParameters ::= SEQUENCE {
         version  ECPVer,          -- version number of the Elliptic Curve
                                   -- domain parameters. Is always 1
         fieldID  FieldID,         -- identifies the finite field over
                                   -- which the Elliptic Curve is defined
         curve    Curve,           -- coefficients a and b of the
                                   -- Elliptic Curve
         base     ECPoint,         -- specifies the base point G
                                   -- on the Elliptic Curve
         order    INTEGER,         -- the order n of the base point
         cofactor INTEGER OPTIONAL -- the integer h = #E(Fq)/n
       }
    
       ECPVer ::= INTEGER {ecpVer1(1)}
    
       FieldID ::= SEQUENCE {
         fieldType  OBJECT IDENTIFIER,
         parameters ANY DEFINED BY fieldType
       }
    
       Curve ::= SEQUENCE {
         a         FieldElement,
         b         FieldElement,
         seed      BIT STRING OPTIONAL
       }
    
       FieldElement ::= OCTET STRING
    
       ECPoint ::= OCTET STRING    -- Elliptic Curve point
     
     
    • Constructor Summary

      Constructors 
      Constructor Description
      ECParameters()
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected byte[] engineGetEncoded()
      Returns the parameters in their primary encoding format.
      protected byte[] engineGetEncoded​(java.lang.String format)
      Returns the parameters in their primary encoding format.
      protected <T extends java.security.spec.AlgorithmParameterSpec>
      T
      engineGetParameterSpec​(java.lang.Class<T> paramSpec)
      Returns a transparent specification of this parameter object.
      protected void engineInit​(byte[] params)
      Imports the specified parameters and decodes them according to the primary decoding format for parameters.
      protected void engineInit​(byte[] params, java.lang.String format)
      Imports the specified parameters and decodes them according to the primary decoding format for parameters.
      protected void engineInit​(java.security.spec.AlgorithmParameterSpec paramSpec)
      Initializes this parameters object using the specified parameters.
      protected java.lang.String engineToString()
      Returns a formatted string describing the parameters.
      • Methods inherited from class java.lang.Object

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

      • ECParameters

        public ECParameters()
        Constructor
    • Method Detail

      • engineGetEncoded

        protected byte[] engineGetEncoded()
                                   throws java.io.IOException
        Returns the parameters in their primary encoding format. The primary encoding format for parameters is ASN.1.
        
         ECParameters ::= SEQUENCE {
           version   ECPVer,          -- version is always 1
           fieldID   FieldID,         -- identifies the finite field over
                                      -- which the curve is defined
           curve     Curve,           -- coefficients a and b of the
                                      -- elliptic curve
           base      ECPoint,         -- specifies the base point P
                                      -- on the elliptic curve
           order     INTEGER,         -- the order n of the base point
           cofactor  INTEGER OPTIONAL -- The integer h = #E(Fq)/n
         }
        
         ECPVer ::= INTEGER {ecpVer1(1)}
        
         Curve ::= SEQUENCE {
           a         FieldElement,
           b         FieldElement,
           seed      BIT STRING OPTIONAL
         }
        
         FieldElement ::= OCTET STRING
        
         ECPoint ::= OCTET STRING
         
        Specified by:
        engineGetEncoded in class java.security.AlgorithmParametersSpi
        Returns:
        the parameters in their primary encoding format
        Throws:
        java.io.IOException - if there are any encoding errors
      • engineGetEncoded

        protected byte[] engineGetEncoded​(java.lang.String format)
                                   throws java.io.IOException
        Returns the parameters in their primary encoding format. The specified encoding format is ignored. The primary encoding format for parameters is ASN.1.
        Specified by:
        engineGetEncoded in class java.security.AlgorithmParametersSpi
        Parameters:
        format - the name of the encoding format. This parameter is ignored
        Returns:
        the parameters in their primary ASN.1 encoding format
        Throws:
        java.io.IOException - if there are any encoding errors
      • engineGetParameterSpec

        protected <T extends java.security.spec.AlgorithmParameterSpec> T engineGetParameterSpec​(java.lang.Class<T> paramSpec)
                                                                                          throws java.security.spec.InvalidParameterSpecException
        Returns a transparent specification of this parameter object. paramSpec identifies the specification class in which the parameters should be returned.
        Specified by:
        engineGetParameterSpec in class java.security.AlgorithmParametersSpi
        Parameters:
        paramSpec - the transparent specification class in which the parameters should be returned. This should be the ECParameterSpec class
        Returns:
        the parameter specification
        Throws:
        java.lang.NullPointerException - if paramSpec is null
        java.security.spec.InvalidParameterSpecException - if the requested parameter specification is inappropriate for this parameter object
      • engineInit

        protected void engineInit​(java.security.spec.AlgorithmParameterSpec paramSpec)
                           throws java.security.spec.InvalidParameterSpecException
        Initializes this parameters object using the specified parameters.
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Parameters:
        paramSpec - the parameter specification
        Throws:
        java.security.spec.InvalidParameterSpecException - if the given parameter specification is inappropriate for the initialization of this parameter object
      • engineInit

        protected void engineInit​(byte[] params)
                           throws java.io.IOException
        Imports the specified parameters and decodes them according to the primary decoding format for parameters. The primary decoding format for parameters is ASN.1.
        
         ECParameters ::= SEQUENCE {
           version   ECPVer,          -- version is always 1
           fieldID   FieldID,         -- identifies the finite field over
                                      -- which the curve is defined
           curve     Curve,           -- coefficients a and b of the
                                      -- elliptic curve
           base      ECPoint,         -- specifies the base point P
                                      -- on the elliptic curve
           order     INTEGER,         -- the order n of the base point
           cofactor  INTEGER OPTIONAL -- The integer h = #E(Fq)/n
         }
        
         ECPVer ::= INTEGER {ecpVer1(1)}
        
         Curve ::= SEQUENCE {
           a         FieldElement,
           b         FieldElement,
           seed      BIT STRING OPTIONAL
         }
        
         FieldElement ::= OCTET STRING
        
         ECPoint ::= OCTET STRING
         
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Parameters:
        params - the encoded parameters
        Throws:
        java.lang.NullPointerException - if params is null
        java.io.IOException - if there are any decoding errors
      • engineInit

        protected void engineInit​(byte[] params,
                                  java.lang.String format)
                           throws java.io.IOException
        Imports the specified parameters and decodes them according to the primary decoding format for parameters. The specified decoding format is ignored. The primary decoding format is ASN.1.
        Specified by:
        engineInit in class java.security.AlgorithmParametersSpi
        Parameters:
        params - the encoded parameters
        format - the name of the decoding format. This parameter is ignored
        Throws:
        java.io.IOException - if there are any decoding errors
      • engineToString

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