BenQ Mobile

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.

BenQ Mobile

Copyright © 2006 BenQ Mobile GmbH & Co. OHG or respective copyright owner.
All Rights Reserved.
BenQ Corp. is a trademark licensee of Siemens AG.


For further information about Mobility Toolkit (MTK) visit our Developer Portal.