de.cscc.crypto.provider
Class RSAKeyFactoryEngine

java.lang.Object
  extended byjava.security.KeyFactorySpi
      extended byde.cscc.crypto.provider.RSAKeyFactoryEngine

public final class RSAKeyFactoryEngine
extends KeyFactorySpi

RSAKeyFactoryEngine Class.

Version:
$Revision: 1.8 $
Author:
Uwe Günther

Constructor Summary
RSAKeyFactoryEngine()
          Creates new RSAKeyFactoryEngine
 
Method Summary
 PrivateKey engineGeneratePrivate(KeySpec keySpec)
          Generates a private key object from the provided key specification (key material).
 PublicKey engineGeneratePublic(KeySpec keySpec)
          Generates a public key object from the provided key specification (key material).
 KeySpec engineGetKeySpec(Key key, Class keySpec)
          Returns a specification (key material) of the given key object.
 Key engineTranslateKey(Key key)
          Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RSAKeyFactoryEngine

public RSAKeyFactoryEngine()
Creates new RSAKeyFactoryEngine

Method Detail

toString

public String toString()
Returns a string representation of the object.

Returns:
a string representation of the object.

engineGeneratePrivate

public PrivateKey engineGeneratePrivate(KeySpec keySpec)
                                 throws InvalidKeySpecException
Generates a private key object from the provided key specification (key material).

The following KeySpecs will produce the following instances of its matching keys:

Parameters:
keySpec - the specification (key material) of the private key.
Returns:
the private key.
Throws:
InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a private key.
NullPointerException - If keySpec or one of the key data in keySpec is null. So you have to construct a valid keySpec without null fields.
See Also:
BigInteger

engineGeneratePublic

public PublicKey engineGeneratePublic(KeySpec keySpec)
                               throws InvalidKeySpecException
Generates a public key object from the provided key specification (key material).

The following KeySpecs will produce the following instances of its matching keys:

Parameters:
keySpec - the specification (key material) of the public key.
Returns:
the public key.
Throws:
InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a public key.
NullPointerException - If keySpec or one of the key data in keySpec is null. So you have to construct a valid keySpec without null fields.
IllegalArgumentException - if any key material from keySpec is negative.

engineGetKeySpec

public KeySpec engineGetKeySpec(Key key,
                                Class keySpec)
                         throws InvalidKeySpecException
Returns a specification (key material) of the given key object. keySpec identifies the specification class in which the key material should be returned. It could, for example, be RSAPublicKeySpec.class, to indicate that the key material should be returned in an instance of the RSAPublicKeySpec class.

The following conversions are valid for this provider:

Parameters:
key - the key.
keySpec - the specification class in which the key material should be returned.
Returns:
the underlying key specification (key material) in an instance of the requested specification class.
Throws:
InvalidKeySpecException - if the requested key specification is inappropriate for the given key, or the given key cannot be dealt with (e.g., the given key has an unrecognized format).
NullPointerException - If one of the params or one of the needed key data in the key is null. So you have to produce a valid key without null fields with your KeyPairGenerator. This should not be a problem with keys from this provider, but maybe with keys from other providers.
IllegalArgumentException - if any key material in the key key is negative. This should not be a problem with keys from this provider, but maybe with keys from other providers.

engineTranslateKey

public Key engineTranslateKey(Key key)
                       throws InvalidKeyException
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.

The following translations are valid for this provider:

Parameters:
key - the key whose provider is unknown or untrusted.
Returns:
the translated key.
Throws:
InvalidKeyException - if the given key cannot be processed by this key factory.
NullPointerException - If the key it self or one of the key data in the key is null. So you have to produce a valid key without null fields with your KeyPairGenerator. This should not be a problem with this provider, but maybe with other providers.
IllegalArgumentException - if any key material in the key key is negative. This should not be a problem with keys from this provider, but maybe with keys from other providers.


Copyright © 2001, 2002 by Uwe Günther. See the COPYING file for more details. Browse the source as HTML.