public class KeyFactory extends Object
| Constructor and Description | 
|---|
KeyFactory()  | 
| Modifier and Type | Method and Description | 
|---|---|
PrivateKey | 
generatePrivate(KeySpec keySpec)
Generates a private key object from the provided key specification (key material). 
 | 
PublicKey | 
generatePublic(KeySpec keySpec)
Generates a public key object from the provided key specification (key material). 
 | 
String | 
getAlgorithm()
Gets the name of the algorithm associated with this  
KeyFactory. | 
static KeyFactory | 
getInstance(String algorithm)
Returns a KeyFactory object that converts public/private keys of the specified algorithm. 
 | 
public static KeyFactory getInstance(String algorithm) throws NoSuchAlgorithmException
algorithm - the name of the requested key algorithm. See the KeyFactory section in the
             Java Cryptography
            Architecture Standard Algorithm Name Documentation for information about standard algorithm names.NoSuchAlgorithmException - if the KeyFactorySpi has no implementation for the specified algorithm.public final String getAlgorithm()
KeyFactory.KeyFactorypublic final PrivateKey generatePrivate(KeySpec keySpec) throws InvalidKeySpecException
keySpec - the specification (key material) of the private key.InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a private key.public final PublicKey generatePublic(KeySpec keySpec) throws InvalidKeySpecException
keySpec - the specification (key material) of the public key.InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a public key.