Class EllipticCurvePrivateKey

  • All Implemented Interfaces:
    java.io.Serializable

    @NotMutable
    @ThreadSafety(level=COMPLETELY_THREADSAFE)
    public final class EllipticCurvePrivateKey
    extends DecodedPrivateKey
    This class provides a data structure for representing the information contained in an elliptic curve private key. As per RFC 5915 section 3, an elliptic curve private key is encoded as follows:
       ECPrivateKey ::= SEQUENCE {
         version        INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
         privateKey     OCTET STRING,
         parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
         publicKey  [1] BIT STRING OPTIONAL
       }
     
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      OID getNamedCurveOID()
      Retrieves the OID for the named curve with which this private key is associated, if available.
      byte[] getPrivateKeyBytes()
      Retrieves the bytes that make up the actual elliptic curve private key.
      ASN1BitString getPublicKey()
      Retrieves the encoded public key with which this private key is associated, if available.
      int getVersion()
      Retrieves the version for the elliptic curve private key.
      void toString​(java.lang.StringBuilder buffer)
      Appends a string representation of this decoded private key to the provided buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getVersion

        public int getVersion()
        Retrieves the version for the elliptic curve private key.
        Returns:
        The version for the elliptic curve private key.
      • getPrivateKeyBytes

        public byte[] getPrivateKeyBytes()
        Retrieves the bytes that make up the actual elliptic curve private key.
        Returns:
        The bytes that make up the actual elliptic curve private key.
      • getNamedCurveOID

        public OID getNamedCurveOID()
        Retrieves the OID for the named curve with which this private key is associated, if available.
        Returns:
        The OID for the named curve with which this private key is associated, or null if it was not included in the encoded key.
      • getPublicKey

        public ASN1BitString getPublicKey()
        Retrieves the encoded public key with which this private key is associated, if available.
        Returns:
        The encoded public key with which this private key is associated, or null if it was not included in the encoded key.
      • toString

        public void toString​(java.lang.StringBuilder buffer)
        Appends a string representation of this decoded private key to the provided buffer.
        Specified by:
        toString in class DecodedPrivateKey
        Parameters:
        buffer - The buffer to which the information should be appended.