Package org.conscrypt

Class OpenSSLECPrivateKey

  • All Implemented Interfaces:
    java.io.Serializable, java.security.interfaces.ECKey, java.security.interfaces.ECPrivateKey, java.security.Key, java.security.PrivateKey, javax.security.auth.Destroyable, OpenSSLKeyHolder

    final class OpenSSLECPrivateKey
    extends java.lang.Object
    implements java.security.interfaces.ECPrivateKey, OpenSSLKeyHolder
    An implementation of a PrivateKey for EC keys based on BoringSSL.
    • Constructor Detail

      • OpenSSLECPrivateKey

        OpenSSLECPrivateKey​(OpenSSLKey key)
      • OpenSSLECPrivateKey

        OpenSSLECPrivateKey​(java.security.spec.ECPrivateKeySpec ecKeySpec)
                     throws java.security.spec.InvalidKeySpecException
        Throws:
        java.security.spec.InvalidKeySpecException
    • Method Detail

      • wrapPlatformKey

        static OpenSSLKey wrapPlatformKey​(java.security.interfaces.ECPrivateKey ecPrivateKey)
                                   throws java.security.InvalidKeyException
        Throws:
        java.security.InvalidKeyException
      • wrapJCAPrivateKeyForTLSStackOnly

        static OpenSSLKey wrapJCAPrivateKeyForTLSStackOnly​(java.security.PrivateKey privateKey,
                                                           java.security.PublicKey publicKey)
                                                    throws java.security.InvalidKeyException
        Wraps the provided private key for use in the TLS/SSL stack only. Sign/decrypt operations using the key will be delegated to the Signature/Cipher implementation of the provider which accepts the key.
        Throws:
        java.security.InvalidKeyException
      • wrapJCAPrivateKeyForTLSStackOnly

        static OpenSSLKey wrapJCAPrivateKeyForTLSStackOnly​(java.security.PrivateKey privateKey,
                                                           java.security.spec.ECParameterSpec params)
                                                    throws java.security.InvalidKeyException
        Wraps the provided private key for use in the TLS/SSL stack only. Sign/decrypt operations using the key will be delegated to the Signature/Cipher implementation of the provider which accepts the key.
        Throws:
        java.security.InvalidKeyException
      • wrapPlatformKey

        private static OpenSSLKey wrapPlatformKey​(java.security.interfaces.ECPrivateKey ecPrivateKey,
                                                  OpenSSLECGroupContext group)
                                           throws java.security.InvalidKeyException
        Throws:
        java.security.InvalidKeyException
      • getInstance

        static OpenSSLKey getInstance​(java.security.interfaces.ECPrivateKey ecPrivateKey)
                               throws java.security.InvalidKeyException
        Throws:
        java.security.InvalidKeyException
      • getAlgorithm

        public java.lang.String getAlgorithm()
        Specified by:
        getAlgorithm in interface java.security.Key
      • getFormat

        public java.lang.String getFormat()
        Specified by:
        getFormat in interface java.security.Key
      • getEncoded

        public byte[] getEncoded()
        Specified by:
        getEncoded in interface java.security.Key
      • getParams

        public java.security.spec.ECParameterSpec getParams()
        Specified by:
        getParams in interface java.security.interfaces.ECKey
      • getS

        public java.math.BigInteger getS()
        Specified by:
        getS in interface java.security.interfaces.ECPrivateKey
      • getPrivateKey

        private java.math.BigInteger getPrivateKey()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • readObject

        private void readObject​(java.io.ObjectInputStream stream)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream stream)
                          throws java.io.IOException
        Throws:
        java.io.IOException