IAIK ECC
version 2.18

iaik.security.ecc.ecdsa
Class ECDSAKeyFactory

java.lang.Object
  extended byjava.security.KeyFactorySpi
      extended byiaik.security.ecc.ecdsa.ECDSAKeyFactory

public class ECDSAKeyFactory
extends java.security.KeyFactorySpi

Implementation of the key factory service provider interface for ECDSA. The following transformations are implemented:

  ECPublicKey  <--> ECDSAPublicKeySpec, X509EncodedKeySpec
  ECPrivateKey <--> ECDSAPrivateKeySpec, PKCS8EncodedKeySpec
 
Do not try to get an instance of this class directly, rather use the KeyFactory method KeyFactory.getInstance("ECDSA").


Constructor Summary
ECDSAKeyFactory()
          Default constructor for the factory.
 
Method Summary
protected  java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
          Generates a private key from the given key spec.
protected  java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
          Generates a public key from the given keySpec
protected  java.security.spec.KeySpec engineGetKeySpec(java.security.Key key, java.lang.Class keySpec)
          Implementation of the engine method.
protected  java.security.Key engineTranslateKey(java.security.Key key)
          Translates the given key object of some unknown or untrusted provider into a key object supported by this ECDSA key factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ECDSAKeyFactory

public ECDSAKeyFactory()
Default constructor for the factory. Do not try to get an instance of this class directly, rather use the KeyFactory method KeyFactory.getInstance("ECDSA").

Method Detail

engineGeneratePrivate

protected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
                                                  throws java.security.spec.InvalidKeySpecException
Generates a private key from the given key spec.

Parameters:
keySpec - the key material; it may either be ECDSAPrivateKeySpec or PKCS8EncodedKeySpec.
Throws:
java.security.spec.InvalidKeySpecException - if the keyspec is not supported or erroneous.

engineGeneratePublic

protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
                                                throws java.security.spec.InvalidKeySpecException
Generates a public key from the given keySpec

Parameters:
keySpec - the key spec may be a X509EncodedKeySpec or a ECDSAPublicKeySpec.
Returns:
the public key generated from the key spec.
Throws:
java.security.spec.InvalidKeySpecException - if the key spec can isn't supported or erroneous.

engineGetKeySpec

protected java.security.spec.KeySpec engineGetKeySpec(java.security.Key key,
                                                      java.lang.Class keySpec)
                                               throws java.security.spec.InvalidKeySpecException
Implementation of the engine method. Converts a key into its spec.

Parameters:
key - the key to be converted (either ECPublicKey or ECPrivateKey)
keySpec - the key specification type. If the given key is of type ECPublicKey the keySpec may be ECDSAPublicKeySpec or X509EncodedKeySpec. Otherwise (key is of type ECPrivateKey) the keySpec may be ECDSAPrivateKeySpec or PKCS8EncodedKeySpec
Returns:
the according key spec
Throws:
java.security.spec.InvalidKeySpecException - if the key can't transformed into the provided keySpec.

engineTranslateKey

protected java.security.Key engineTranslateKey(java.security.Key key)
                                        throws java.security.InvalidKeyException
Translates the given key object of some unknown or untrusted provider into a key object supported by this ECDSA key factory. This method only can translate keys of type ECPublicKey or ECPrivateKey.

Parameters:
key - the key to be translated
Returns:
the translated key
Throws:
java.security.InvalidKeyException - if the given key cannot be translated

IAIK ECC
version 2.18

IAIK-ECC 2.18, (c) 2002 IAIK, (c) 2003 SIC