|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.security.KeyFactory
public class KeyFactory
KeyFactory is an engine class that can be used to translate between
public and private key objects and convert keys between their external
representation, that can be easily transported and their internal
representation.
| Constructor Summary | |
|---|---|
protected |
KeyFactory(KeyFactorySpi keyFacSpi,
Provider provider,
String algorithm)
Constructs a new instance of KeyFactory with the specified
arguments. |
| Method Summary | ||
|---|---|---|
PrivateKey |
generatePrivate(KeySpec keySpec)
Generates a instance of PrivateKey from the given key
specification. |
|
PublicKey |
generatePublic(KeySpec keySpec)
Generates a instance of PublicKey from the given key
specification. |
|
String |
getAlgorithm()
Returns the name of the algorithm associated with this KeyFactory
. |
|
static KeyFactory |
getInstance(String algorithm)
Returns a new instance of KeyFactory that utilizes the specified
algorithm. |
|
static KeyFactory |
getInstance(String algorithm,
Provider provider)
Returns a new instance of KeyFactory that utilizes the specified
algorithm from the specified provider. |
|
static KeyFactory |
getInstance(String algorithm,
String provider)
Returns a new instance of KeyFactory that utilizes the specified
algorithm from the specified provider. |
|
|
getKeySpec(Key key,
Class<T> keySpec)
Returns the key specification for the specified key. |
|
Provider |
getProvider()
Returns the provider associated with this KeyFactory. |
|
Key |
translateKey(Key key)
Translates the given key into a key from this key factory. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected KeyFactory(KeyFactorySpi keyFacSpi,
Provider provider,
String algorithm)
KeyFactory with the specified
arguments.
keyFacSpi - the concrete key factory service.provider - the provider.algorithm - the algorithm to use.| Method Detail |
|---|
public static KeyFactory getInstance(String algorithm)
throws NoSuchAlgorithmException
KeyFactory that utilizes the specified
algorithm.
algorithm - the name of the algorithm.
KeyFactory that utilizes the specified
algorithm.
NoSuchAlgorithmException - if no provider provides the requested algorithm.
public static KeyFactory getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException,
NoSuchProviderException
KeyFactory that utilizes the specified
algorithm from the specified provider.
algorithm - the name of the algorithm.provider - the name of the provider.
KeyFactory that utilizes the specified
algorithm from the specified provider.
NoSuchAlgorithmException - if the provider does not provide the requested algorithm.
NoSuchProviderException - if the requested provider is not available.
IllegalArgumentException - if provider is null or empty.
public static KeyFactory getInstance(String algorithm,
Provider provider)
throws NoSuchAlgorithmException
KeyFactory that utilizes the specified
algorithm from the specified provider.
algorithm - the name of the algorithm.provider - the security provider.
KeyFactory that utilizes the specified
algorithm from the specified provider.
NoSuchAlgorithmException - if the provider does not provide the requested algorithm.public final Provider getProvider()
KeyFactory.
KeyFactory.public final String getAlgorithm()
KeyFactory
.
KeyFactory
.
public final PublicKey generatePublic(KeySpec keySpec)
throws InvalidKeySpecException
PublicKey from the given key
specification.
keySpec - the specification of the public key
InvalidKeySpecException - if the specified keySpec is invalid
public final PrivateKey generatePrivate(KeySpec keySpec)
throws InvalidKeySpecException
PrivateKey from the given key
specification.
keySpec - the specification of the private key.
InvalidKeySpecException - if the specified keySpec is invalid.
public final <T extends KeySpec> T getKeySpec(Key key,
Class<T> keySpec)
throws InvalidKeySpecException
key - the key from which the specification is requested.keySpec - the type of the requested KeySpec.
InvalidKeySpecException - if the key can not be processed, or the requested requested
KeySpec is inappropriate for the given key.
public final Key translateKey(Key key)
throws InvalidKeyException
key - the key to translate.
InvalidKeyException - if the specified key can not be translated by this key
factory.
|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||