All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class au.net.aba.crypto.provider.RSAKeyFactory

java.lang.Object
   |
   +----au.net.aba.security.KeyFactorySpi
           |
           +----au.net.aba.crypto.provider.RSAKeyFactory

public class RSAKeyFactory
extends KeyFactorySpi
This class is used to convert RSA keys into a format usable by the ABA provider. Currently this class can convert from a KeySpec into a Key, or from one of the standard RSA Key interfaces into an ABA key.

The supported KeySpec classes are AsciiEncodedKeySpec, RSAPrivateCrtKeySpec, RSAPublicKeySpec, X509EncodedKeySpec and PKCS8EncodedKeySpec.

The supported RSA Key interfaces are RSAPublicKey, RSAPrivateKey and RSAPrivateCrtKey.

This class should not be instantiated directly, instead use the java.security.KeyFactory interface.

See Also:
KeyFactory, RSAPublicKey;, RSAPrivateKey;, RSAPrivateKeySpec;, RSAPublicKeySpec;, X509EncodedKeySpec;, PKCS8EncodedKeySpec;, AsciiEncodedKeySpec;

Variable Index

 o ident

Constructor Index

 o RSAKeyFactory()

Method Index

 o engineGeneratePrivate(KeySpec)
Generates a private key object from the provided key specification (key material).
 o engineGeneratePublic(KeySpec)
Generates a public key object from the provided key specification (key material).
 o engineGetKeySpec(Key, Class)
Returns a specification (key material) of the given key object.
 o engineTranslateKey(Key)
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.
 o parseKey(byte[])
Parse a key from the ABA/PGP format into an array of BigIntegers.

Variables

 o ident
 public static final String ident

Constructors

 o RSAKeyFactory
 public RSAKeyFactory()

Methods

 o engineGeneratePrivate
 protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException
Generates a private key object from the provided key specification (key material). This class supports the AsciiEncodedKeySpec, RSAPrivateKeySpec, RSAPrivateCrtKeySpec and PKCS8Encoded KeySpec classes.

Returns:
s The private key.
Throws: InvalidKeySpecException
The provided KeySpec was not an AsciiEncodedKeySpec, RSAPrivateKeySpec, RSAPrivateCrtKeySpec or PKCS8EncodedKeySpec KeySpec instance.
Overrides:
engineGeneratePrivate in class KeyFactorySpi
 o engineGeneratePublic
 protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException
Generates a public key object from the provided key specification (key material). This class supports the AsciiEncodedKeySpec, RSAPublicKeySpec and X509EncodedKeySpec KeySpec classes.

Returns:
s The public key.
Throws: InvalidKeySpecException
The provided KeySpec was not an AsciiEncodedKeySpec, RSAPublicKeySpec or X509EncodedKeySpec KeySpec.
Overrides:
engineGeneratePublic in class KeyFactorySpi
 o engineGetKeySpec
 protected KeySpec engineGetKeySpec(Key key,
                                    Class spec) 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.

Currently supports standard RSA keys and RSAPublicKeySpec, RSAPrivateKeySpec, RSAPrivateCrtKeySpec, X509EncodedKeySpec and PKCS8EncodedKeySpec KeySpec classes.

Parameters:
key - the key the key material is to be recovered from.
spec - the class the new key spec object is meant to be from.
Returns:
the new key spec object representing the key material in key.
Overrides:
engineGetKeySpec in class KeyFactorySpi
 o engineTranslateKey
 protected 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.

This KeyFactory will convert any key that implements either RSAPrivateCrtKey, RSAPrivateKey, or the RSAPublicKey interface.

Parameters:
key - the key to be translated.
Returns:
the same key, only for this provider.
Overrides:
engineTranslateKey in class KeyFactorySpi
 o parseKey
 protected static BigInteger[] parseKey(byte keyBytes[])
Parse a key from the ABA/PGP format into an array of BigIntegers. The format is:
      modulus.publicExp.privateExp.p.q
 

Parameters:
keyBytes - an ASCII string describing the key.
Returns:
an array of BigIntegers that make up the key.

All Packages  Class Hierarchy  This Package  Previous  Next  Index