com.motorola.iden.security
Class KeyPairGenerator
java.lang.Object
|
+--com.motorola.iden.security.KeyPairGenerator
- public class KeyPairGenerator
- extends java.lang.Object
The KeyPairGenerator class is used to generate pairs of
public and private keys. Key pair generators are constructed using the
getInstance
factory methods (static methods that
return instances of a given class).
A Key pair generator for a particular algorithm creates a public/private
key pair that can be used with this algorithm. It also associates
algorithm-specific parameters with each of the generated keys.
MOTOROLA and the Stylized M Logo are registered trademarks of
Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© Copyright 2002 - 2004 Motorola, Inc. All Rights Reserved.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KeyPairGenerator
protected KeyPairGenerator(KeyPairGeneratorSpi keypairgeneratorspi)
- Creates a KeyPairGenerator object.
- Parameters:
keypairgeneratorspi
- the instance of an algorithm which implements KeyPairGeneratorSpi
getInstance
public static KeyPairGenerator getInstance(java.lang.String algorithm)
throws NoSuchAlgorithmException
- Generates a KeyPairGenerator object that implements the specified key pair
generation algorithm.
- Parameters:
algorithm
- name of the algorithm. Algorithm DH and ECDH are available in current implementation.- Returns:
- a key pair generator that implements the requested algorithm.
NoSuchAlgorithmException if the specified algorithm is
not available.
initialize
public void initialize(int keysize)
throws InvalidAlgorithmParameterException
- Initializes the key pair generator for a certain keysize using
a default parameter set.
- Parameters:
keysize
- the keysize. This is an
algorithm-specific metric, such as modulus length, specified in
number of bits.- Throws:
InvalidAlgorithmParameterException
- if the keysize
is not
supported by this KeyPairGenerator object.
initialize
public void initialize(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException
- Initializes the key pair generator for a specified parameter
set.
- Parameters:
params
- the parameter set used to generate the keys.- Throws:
InvalidAlgorithmParameterException
- if the given params
are not
supported by this KeyPairGenerator object.
generateKeyPair
public KeyPair generateKeyPair()
- Generates a key pair. Key pair generator must be initialized to generate key pair, or null
will be returned.
- Returns:
- the generated key pair