public final class

ECParameters

extends AlgorithmParametersSpi
java.lang.Object
   ↳ java.security.AlgorithmParametersSpi
     ↳ sun.security.ec.ECParameters

Class Overview

This class implements encoding and decoding of Elliptic Curve parameters as specified in RFC 3279. However, only named curves are currently supported. ASN.1 from RFC 3279 follows. Note that X9.62 (2005) has added some additional options.

    EcpkParameters ::= CHOICE {
      ecParameters  ECParameters,
      namedCurve    OBJECT IDENTIFIER,
      implicitlyCA  NULL }

    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
 

Summary

Public Constructors
ECParameters()
Public Methods
static ECParameterSpec decodeParameters(byte[] params)
static ECPoint decodePoint(byte[] data, EllipticCurve curve)
static byte[] encodeParameters(ECParameterSpec params)
static byte[] encodePoint(ECPoint point, EllipticCurve curve)
static String getCurveName(ECParameterSpec params)
static NamedCurve getNamedCurve(ECParameterSpec params)
Protected Methods
byte[] engineGetEncoded()
Returns the parameters in their primary encoding format.
byte[] engineGetEncoded(String encodingMethod)
Returns the parameters encoded in the specified format.
<T extends AlgorithmParameterSpec> T engineGetParameterSpec(Class<T> spec)
Returns a (transparent) specification of this parameters object.
void engineInit(AlgorithmParameterSpec paramSpec)
Initializes this parameters object using the parameters specified in paramSpec.
void engineInit(byte[] params)
Imports the specified parameters and decodes them according to the primary decoding format for parameters.
void engineInit(byte[] params, String decodingMethod)
Imports the parameters from params and decodes them according to the specified decoding format.
String engineToString()
Returns a formatted string describing the parameters.
[Expand]
Inherited Methods
From class java.security.AlgorithmParametersSpi
From class java.lang.Object

Public Constructors

public ECParameters ()

Public Methods

public static ECParameterSpec decodeParameters (byte[] params)

Throws
IOException

public static ECPoint decodePoint (byte[] data, EllipticCurve curve)

Throws
IOException

public static byte[] encodeParameters (ECParameterSpec params)

public static byte[] encodePoint (ECPoint point, EllipticCurve curve)

public static String getCurveName (ECParameterSpec params)

public static NamedCurve getNamedCurve (ECParameterSpec params)

Protected Methods

protected byte[] engineGetEncoded ()

Returns the parameters in their primary encoding format. The primary encoding format for parameters is ASN.1, if an ASN.1 specification for this type of parameters exists.

Returns
  • the parameters encoded using their primary encoding format.
Throws
IOException

protected byte[] engineGetEncoded (String encodingMethod)

Returns the parameters encoded in the specified format. If format is null, the primary encoding format for parameters is used. The primary encoding format is ASN.1, if an ASN.1 specification for these parameters exists.

Parameters
encodingMethod the name of the encoding format.
Returns
  • the parameters encoded using the specified encoding scheme.
Throws
IOException

protected T engineGetParameterSpec (Class<T> spec)

Returns a (transparent) specification of this parameters object. paramSpec identifies the specification class in which the parameters should be returned. It could, for example, be DSAParameterSpec.class, to indicate that the parameters should be returned in an instance of the DSAParameterSpec class.

Parameters
spec the the specification class in which the parameters should be returned.
Returns
  • the parameter specification.

protected void engineInit (AlgorithmParameterSpec paramSpec)

Initializes this parameters object using the parameters specified in paramSpec.

Parameters
paramSpec the parameter specification.

protected void engineInit (byte[] params)

Imports the specified parameters and decodes them according to the primary decoding format for parameters. The primary decoding format for parameters is ASN.1, if an ASN.1 specification for this type of parameters exists.

Parameters
params the encoded parameters.
Throws
IOException

protected void engineInit (byte[] params, String decodingMethod)

Imports the parameters from params and decodes them according to the specified decoding format. If format is null, the primary decoding format for parameters is used. The primary decoding format is ASN.1, if an ASN.1 specification for these parameters exists.

Parameters
params the encoded parameters.
decodingMethod the name of the decoding format.
Throws
IOException

protected String engineToString ()

Returns a formatted string describing the parameters.

Returns
  • a formatted string describing the parameters.