|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Object | +--java.security.KeyFactory
Instances of this class are used to convert back and forth between keys and key specifications.
| Constructor Summary | |
|---|---|
protected |
KeyFactory(KeyFactorySpi keyFactorySpi,
Provider provider,
String algName)
Constructs a new instance of this class with the given implementation, provider and named algorithm. |
| Method Summary | |
|---|---|
PrivateKey |
generatePrivate(KeySpec keySpec)
Generates a private key for the given key specification. |
PublicKey |
generatePublic(KeySpec keySpec)
Generates a public key for the given key specification. |
String |
getAlgorithm()
Answers the standard Java Security name for the algorithm being used by the receiver. |
static KeyFactory |
getInstance(String algorithmName)
Answers a new KeyFactory which is capable of running the algorithm described by the argument. |
static KeyFactory |
getInstance(String algorithm,
Provider provider)
Answers a new KeyFactory which is capable of running the algorithm described by the argument. |
static KeyFactory |
getInstance(String algorithmName,
String providerName)
Answers a new KeyFactory which is capable of running the algorithm described by the argument. |
KeySpec |
getKeySpec(Key key,
Class keySpec)
Answers a key specification for a given key. |
Provider |
getProvider()
Returns the Provider of the key factory represented by the receiver. |
Key |
translateKey(Key key)
Translates a generic key (any provider, trusted or not) to an instance of 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 keyFactorySpi,
Provider provider,
String algName)
keyFactorySpi - KeyFactorySpi
The actual key factory implementation.provider - Provider
The provider of the key factory.algName - String
Algorithm name.| Method Detail |
public final PrivateKey generatePrivate(KeySpec keySpec)
throws InvalidKeySpecException
keySpec - KeySpec the key specification to be used for key generation.
InvalidKeySpecException - if the provided key specification is not appropriatepublic final String getAlgorithm()
public static KeyFactory getInstance(String algorithmName,
String providerName)
throws NoSuchAlgorithmException,
NoSuchProviderException
algorithmName - java.lang.String Name of the algorithm desiredproviderName - java.lang.String Name of the provider which has to implement the algorithm
NoSuchAlgorithmException - If the algorithm cannot be found
NoSuchProviderException - If the provider cannot be foundpublic static KeyFactory getInstance(String algorithm,
Provider provider)
throws NoSuchAlgorithmException
algorithm - java.lang.String Name of the algorithm desiredprovider - Provider Provider which has to implement the algorithm
NoSuchAlgorithmException - If the algorithm cannot be foundpublic final KeySpec getKeySpec(Key key,
Class keySpec)
throws InvalidKeySpecException
key - Key the key for which the specification is to be computed.keySpec - Class the class of the result specification
keySpec.
InvalidKeySpecException - if the provided key specification is not appropriatepublic final Provider getProvider()
public final Key translateKey(Key key)
throws InvalidKeyException
key - Key the key for which the new key is to be computed.
InvalidKeyException - if the specified key is not valid (improperly encoded, parameters missing, etc)public final PublicKey generatePublic(KeySpec keySpec)
throws InvalidKeySpecException
keySpec - KeySpec the key specification to be used for key generation.
InvalidKeySpecException - if the provided key specification is not appropriatepublic static KeyFactory getInstance(String algorithmName)
throws NoSuchAlgorithmException
algorithmName - java.lang.String Name of the algorithm desired
NoSuchAlgorithmException - If the algorithm cannot be found
|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||