iaik.security.dh
Class ESDHKeyPairGenerator

java.lang.Object
  |
  +--java.security.KeyPairGeneratorSpi
        |
        +--java.security.KeyPairGenerator
              |
              +--iaik.security.dh.ESDHKeyPairGenerator

public class ESDHKeyPairGenerator
extends KeyPairGenerator

Key pair generator for ESDH keys to be used for Ephemeral Static Diffie Hellman key agreement as specified by RFC 2631.

For creating a ESDH key pair necessary a KeyPairGenerator has to be instantiated, properly initialized and directed to actually generate the keys by calling the generateKeyPair method. If the generator is not initialized by explicitly calling an initialize method, the modulus length per default is set to 1024 bits.

Generating ESDH keys using a modulus length of, e.g. 1024 bits (explicitly initialized), may be done by:

KeyPairGenerator key_gen = KeyPairGenerator.getIntance("ESDH");
 key_gen.initialize(1024, sec_random);
 KeyPair key_pair = key_gen.generateKeyPair();
 

The example above initializes the key pair generator algorithm-independently by only specifying the length of the modulus. For performing an algorithm-specific initialization, an explicit cast to ESDHKeyPairGenerator would be necessary, e.g.:

 ESDHKeyPairGenerator dh_key_gen = (ESDHKeyPairGenerator)key_gen;
 dh_key_gen.initialize(dh_param_spec, sec_random);

Guidelines on how to create key pairs using a KeyPairGenerator can be found in http://java.sun.com/products/JDK/1.1/docs/guide/security/CryptoSpec.html.

Version:
File Revision 10
See Also:
KeyPairGenerator, KeyPair, ESDHPublicKey, ESDHPrivateKey, ESDHKeyFactory, ESDHKeyAgreement

Constructor Summary
ESDHKeyPairGenerator()
          Default constructor for creating a ESDHKeyPairGenerator object.
 
Method Summary
 KeyPair generateKeyPair()
          Actually generates the requested ESDH KeyPair.
 void initialize(AlgorithmParameterSpec param, SecureRandom random)
          Initializes this ESDHKeyPairGenerator with given ESDH parameter specification and random seed.
 void initialize(int primeLength)
          Initializes the ESDHKeyPairGenerator for given prime modulus length.
 void initialize(int primeLength, SecureRandom random)
          Initializes the ESDHKeyPairGenerator for given prime modulus length with the given random seed.
 
Methods inherited from class java.security.KeyPairGenerator
genKeyPair, getAlgorithm, getInstance, getInstance, getProvider, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ESDHKeyPairGenerator

public ESDHKeyPairGenerator()
Default constructor for creating a ESDHKeyPairGenerator object.
Method Detail

initialize

public void initialize(int primeLength)
Initializes the ESDHKeyPairGenerator for given prime modulus length.

Overrides:
initialize in class KeyPairGenerator
Parameters:
primLength - the length of the prime modulus in bits

initialize

public void initialize(int primeLength,
                       SecureRandom random)
Initializes the ESDHKeyPairGenerator for given prime modulus length with the given random seed.

Overrides:
initialize in class KeyPairGenerator
Parameters:
primLength - the length of the prime modulus in bits
random - the random seed as SecureRandom.

initialize

public void initialize(AlgorithmParameterSpec param,
                       SecureRandom random)
                throws InvalidAlgorithmParameterException
Initializes this ESDHKeyPairGenerator with given ESDH parameter specification and random seed.

Overrides:
initialize in class KeyPairGenerator
Parameters:
param - the ESDHParameterSpec representing prime modulus p, base generator g, prime factor q, the subgroup factor j (if available) and the seed seed and pgenCounter pgenCounter (if available).
random - the random seed as SecureRandom
Throws:
InvalidParameterException - if the given algorithm parameter specification is not a ESDHParameterSpec or the size of the exponent is not shorter than that of the prime modulus, both derived from the given ESDH parameter specification

generateKeyPair

public KeyPair generateKeyPair()
Actually generates the requested ESDH KeyPair.

Overrides:
generateKeyPair in class KeyPairGenerator
Returns:
the requested key pair

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK