org.bouncycastle.asn1.sec

## Class ECPrivateKey

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.sec.ECPrivateKey

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class ECPrivateKey
      extends ASN1Object

  the elliptic curve private key object from SEC 1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ECPrivateKey(ASN1OctetString privateKey, ASN1Encodable parameters, ASN1BitString publicKey)`
    `ECPrivateKey(int orderBitLength, java.math.BigInteger key)` Base constructor.
    `ECPrivateKey(int orderBitLength, java.math.BigInteger key, ASN1BitString publicKey, ASN1Encodable parameters)`
    `ECPrivateKey(int orderBitLength, java.math.BigInteger key, ASN1Encodable parameters)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ECPrivateKey` | `getInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
    `static ECPrivateKey` | `getInstance(java.lang.Object obj)`
    `java.math.BigInteger` | `getKey()`
    `ASN1Object` | `getParametersObject()`
    `ASN1OctetString` | `getPrivateKey()`
    `ASN1BitString` | `getPublicKey()`
    `static ECPrivateKey` | `getTagged(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
    `ASN1Primitive` | `toASN1Primitive()` ECPrivateKey ::= SEQUENCE { version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), privateKey OCTET STRING, parameters [0] Parameters OPTIONAL, publicKey [1] BIT STRING OPTIONAL }

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ECPrivateKey

          public ECPrivateKey(int orderBitLength,
                              java.math.BigInteger key)

      Base constructor.
      Parameters:
        `orderBitLength` - the bitLength of the order of the curve.
        `key` - the private key value.

    - #### ECPrivateKey

          public ECPrivateKey(int orderBitLength,
                              java.math.BigInteger key,
                              ASN1Encodable parameters)

    - #### ECPrivateKey

          public ECPrivateKey(int orderBitLength,
                              java.math.BigInteger key,
                              ASN1BitString publicKey,
                              ASN1Encodable parameters)

    - #### ECPrivateKey

          public ECPrivateKey(ASN1OctetString privateKey,
                              ASN1Encodable parameters,
                              ASN1BitString publicKey)

  - ### Method Detail

    - #### getInstance

          public static ECPrivateKey getInstance(java.lang.Object obj)

    - #### getInstance

          public static ECPrivateKey getInstance(ASN1TaggedObject taggedObject,
                                                 boolean declaredExplicit)

    - #### getTagged

          public static ECPrivateKey getTagged(ASN1TaggedObject taggedObject,
                                               boolean declaredExplicit)

    - #### getKey

          public java.math.BigInteger getKey()

    - #### getPrivateKey

          public ASN1OctetString getPrivateKey()

    - #### getPublicKey

          public ASN1BitString getPublicKey()

    - #### getParametersObject

          public ASN1Object getParametersObject()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      ECPrivateKey ::= SEQUENCE { version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), privateKey OCTET STRING, parameters [0] Parameters OPTIONAL, publicKey [1] BIT STRING OPTIONAL }
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.