Class ECKeyFactory


  • public final class ECKeyFactory
    extends java.security.KeyFactorySpi
    This class implements the key factory service provider interface for the Elliptic Curve algorithm of the IBMJCECCA provider.
    • Constructor Summary

      Constructors 
      Constructor Description
      ECKeyFactory()
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.security.PrivateKey engineGeneratePrivate​(java.security.spec.KeySpec keySpec)
      Generates an Elliptic Curve private key from the provided key specification (key material).
      protected java.security.PublicKey engineGeneratePublic​(java.security.spec.KeySpec keySpec)
      Generates an Elliptic Curve public key from the provided key specification (key material).
      protected <T extends java.security.spec.KeySpec>
      T
      engineGetKeySpec​(java.security.Key key, java.lang.Class<T> keySpec)
      Returns a specification (key material) of the given Elliptic Curve key object.
      protected java.security.Key engineTranslateKey​(java.security.Key key)
      Translates an Elliptic Curve key object, whose provider may be unknown or potentially untrusted, into a corresponding Elliptic Curve key object of this key factory.
      • Methods inherited from class java.lang.Object

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

      • ECKeyFactory

        public ECKeyFactory()
        Constructor
    • Method Detail

      • engineGeneratePublic

        protected java.security.PublicKey engineGeneratePublic​(java.security.spec.KeySpec keySpec)
                                                        throws java.security.spec.InvalidKeySpecException
        Generates an Elliptic Curve public key from the provided key specification (key material).
        Specified by:
        engineGeneratePublic in class java.security.KeyFactorySpi
        Parameters:
        keySpec - the specification (key material) of the public key. Three key specifications are supported, including ECPublicKeySpec, KeyLabelKeySpec, and X509EncodedKeySpec. In the case of using a KeyLabelKeySpec, the key label must point to an existing PKDS record
        Returns:
        an Elliptic Curve public key representing the material contained within the specified key specification
        Throws:
        java.security.spec.InvalidKeySpecException - if the given key specification is inappropriate for this key factory
      • engineGeneratePrivate

        protected java.security.PrivateKey engineGeneratePrivate​(java.security.spec.KeySpec keySpec)
                                                          throws java.security.spec.InvalidKeySpecException
        Generates an Elliptic Curve private key from the provided key specification (key material).
        Specified by:
        engineGeneratePrivate in class java.security.KeyFactorySpi
        Parameters:
        keySpec - the specification (key material) of the private key. Four key specifications are supported, including PKCS8EncodedKeySpec, ECPrivateKeySpec, KeyLabelKeySpec, and ECPrivateHWKeySpec. In the case of using a KeyLabelKeySpec, the key label must point to an existing PKDS record
        Returns:
        an Elliptic Curve private key representing the material contained within the specified key specification
        Throws:
        java.security.spec.InvalidKeySpecException - if the given key specification is inappropriate for this key factory
      • engineGetKeySpec

        protected <T extends java.security.spec.KeySpec> T engineGetKeySpec​(java.security.Key key,
                                                                            java.lang.Class<T> keySpec)
                                                                     throws java.security.spec.InvalidKeySpecException
        Returns a specification (key material) of the given Elliptic Curve key object. keySpec identifies the specification class in which the key material should be returned.
        Specified by:
        engineGetKeySpec in class java.security.KeyFactorySpi
        Parameters:
        key - the Elliptic Curve public or private key. If public key, it must be an instance of ECPublicKey. If private key, it must be an instance of ECPrivateHWKey.
        keySpec - the specification class in which the key material should be returned. For a public key, the supported specification classes are ECPublicKeySpec and X509EncodedKeySpec. For a private key, the supported specification classes are ECPrivateHWKeySpec and KeyLabelKeySpec, and ECPrivateKeySpec for CLEAR type keys.
        Returns:
        the underlying key specification (key material) in an instance of the requested specification class
        Throws:
        java.security.spec.InvalidKeySpecException - if the requested key specification is inappropriate for the given key, or the given key cannot be dealt with
      • engineTranslateKey

        protected java.security.Key engineTranslateKey​(java.security.Key key)
                                                throws java.security.InvalidKeyException
        Translates an Elliptic Curve key object, whose provider may be unknown or potentially untrusted, into a corresponding Elliptic Curve key object of this key factory.
        Specified by:
        engineTranslateKey in class java.security.KeyFactorySpi
        Parameters:
        key - the Elliptic Curve key whose provider is unknown or untrusted. It can be either an instance of ECPublicKey or an instance of ECPrivateKey.
        Returns:
        the translated Elliptic Curve key
        Throws:
        java.security.InvalidKeyException - if the given key cannot be processed