SATSA - JSR177

java.security
Class KeyFactory

java.lang.Object
  |
  +--java.security.KeyFactory

public class KeyFactory
extends Object

Key factories are used to convert key specifications (transparent representations of the underlying key material) into keys (opaque cryptographic keys of type Key).

Since:
1.2
See Also:
Key, PublicKey, KeySpec, X509EncodedKeySpec

Method Summary
 PublicKey generatePublic(KeySpec keySpec)
          Generates a public key object from the provided key specification (key material).
static KeyFactory getInstance(String algorithm)
          Generates a KeyFactory object that implements the specified algorithm.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static KeyFactory getInstance(String algorithm)
                              throws NoSuchAlgorithmException
Generates a KeyFactory object that implements the specified algorithm.

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.
Returns:
a KeyFactory object for the specified algorithm.
Throws:
NoSuchAlgorithmException - if the requested algorithm is not available

generatePublic

public final 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:
the public key.
Throws:
InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a public key.

SATSA - JSR177

Submit a comment or suggestion Version 1.0 of SATSA Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright 1993-2004 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.