Use is subject to License Terms. Your use of this web site or any of its contents or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JSR 177

java.security
Class KeyFactory

java.lang.Object
  extended by java.security.KeyFactory

public class KeyFactory
extends java.lang.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
Version:
1.28, 05/07/02
Author:
Jan Luehe
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(java.lang.String algorithm)
          Generates a KeyFactory object that implements the specified algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static KeyFactory getInstance(java.lang.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.

JSR 177

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 177 specification.