All Packages Class Hierarchy This Package Previous Next Index
Class au.net.aba.security.KeyFactory
java.lang.Object
|
+----au.net.aba.security.KeyFactory
- public class KeyFactory
- extends Object
A factory class for creating Keys.
-
ident
-
-
KeyFactory(KeyFactorySpi, Provider, String)
- Creates a KeyFactory object.
-
generatePrivate(KeySpec)
- Generates a private key object from the provided key specification
(key material).
-
generatePublic(KeySpec)
- Generates a public key object from the provided key
specification (key material).
-
getAlgorithm()
- Returns the algorithm of this key factory object.
-
getInstance(String)
- Generates a KeyFactory object that implements the specified digest
algorithm.
-
getInstance(String, String)
- Generates a KeyFactory object for the specified algorithm from
the specified provider.
-
getKeySpec(Key, Class)
- Returns a specification (key material) of the given key object.
-
getProvider()
- Returns the provider of this key factory object.
-
translateKey(Key)
- Translates a key object, whose provider may be unknown or
potentially untrusted, into a corresponding key object of this
key factory.
ident
public static final String ident
KeyFactory
protected KeyFactory(KeyFactorySpi keyFacSpi,
Provider provider,
String algorithm)
- Creates a KeyFactory object.
- Parameters:
- keyFacSpi - the delegate
- provider - the provider
- algorithm - the algorithm
getInstance
public static final KeyFactory getInstance(String algorithm) throws NoSuchAlgorithmException
- Generates a KeyFactory object that implements the specified digest
algorithm. If the default provider package provides an
implementation of the requested digest algorithm, an instance of
KeyFactory containing that implementation is returned. If the
algorithm is not available in the default package, other packages
are searched.
- Parameters:
- algorithm - the standard name of the requested key algorithm.
See Appendix A in the Java Cryptography Extension API
Specification & Reference for information about standard
algorithm names.
- Returns:
- the new KeyFactory object.
- Throws: NoSuchAlgorithmException
- if the requested algorithm is
not available in the default provider package or any of the other
provider packages that were searched.
getInstance
public static final KeyFactory getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException, NoSuchProviderException
- Generates a KeyFactory object for the specified algorithm from
the specified provider.
- Parameters:
- algorithm - the name of the requested key algorithm. See
Appendix A in the Java Cryptography Architecture API Specification
& Reference for information about standard algorithm names.
- provider - the name of the provider.
- Returns:
- a KeyFactory object for the specified algorithm.
- Throws: NoSuchAlgorithmException
- if the algorithm is not
available from the specified provider.
- Throws: NoSuchProviderException
- if the provider has not been
configured.
- See Also:
- Provider
getProvider
public final Provider getProvider()
- Returns the provider of this key factory object.
- Returns:
- the provider of this key factory object
getAlgorithm
public final String getAlgorithm()
- Returns the algorithm of this key factory object.
- Returns:
- the algorithm of this key factory object
generatePrivate
public PrivateKey generatePrivate(KeySpec keySpec) throws InvalidKeySpecException
- Generates a private key object from the provided key specification
(key material).
- Parameters:
- keySpec - The specification (key material of the private key.
- Returns:
- s the private key.
- Throws: InvalidKeySpecException
- if the given key specification
is inappropriate for this key factory to produce a private key.
generatePublic
public PublicKey generatePublic(KeySpec keySpec) throws InvalidKeySpecException
- Generates a public key object from the provided key
specification (key material).
- Parameters:
- keySpec - - the specification (key material) of the
public key.
- Returns:
- s the public key.
- Throws: InvalidKeySpecException
- - if the given key
specification is inappropriate for this key factory to
produce a public key.
getKeySpec
public final KeySpec getKeySpec(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 DSAPublicKeySpec.class,
to indicate that the key material should be returned in an instance
of the DSAPublicKeySpec class.
- Parameters:
- key - the key
- keySpec - the specification class in which the key material
should be returned.
- Throws: InvalidKeySpecException
- - if the requested key
specification is inappropriate for the given key, or the given key
cannot be processed (e.g., the given key has an unrecognized
algorithm or format).
translateKey
public final Key translateKey(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.
- 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.
All Packages Class Hierarchy This Package Previous Next Index