spki
Class KeyPairFactory

java.lang.Object
  |
  +--spki.KeyPairFactory

public final class KeyPairFactory
extends Object

spki.demo KeyPairFactory class.

Version:
$Id: KeyPairFactory.java,v 1.4 2002/07/25 17:53:53 tep Exp $
Author:
Tep Narula <tep@win.trlabs.ca>

Field Summary
private static String __ME
          This class's full name.
static int PRIVKEY_INDEX
          the position of the private key in each element of the generated key-pair.
private static String PROVIDER_NAME
          the name of the JCE provider used ("Cryptix").
static int PUBKEY_INDEX
          the position of the public key in each element of the generated key-pair.
 
Constructor Summary
private KeyPairFactory()
           
 
Method Summary
static Key[] generateKeyPair(String pub_alg, int key_length)
          generate and return a of key-pair.
static Key[][] generateKeyPairs(int num, String pub_alg, int key_length)
          generate and return a specifiable number of key-pairs.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

__ME

private static final String __ME
This class's full name.

PRIVKEY_INDEX

public static final int PRIVKEY_INDEX
the position of the private key in each element of the generated key-pair.

PUBKEY_INDEX

public static final int PUBKEY_INDEX
the position of the public key in each element of the generated key-pair.

PROVIDER_NAME

private static final String PROVIDER_NAME
the name of the JCE provider used ("Cryptix").
Constructor Detail

KeyPairFactory

private KeyPairFactory()
Method Detail

generateKeyPair

public static final Key[] generateKeyPair(String pub_alg,
                                          int key_length)
                                   throws SPKIException
generate and return a of key-pair.
Parameters:
pub_alg - the public-key algorithm to use.
key_length - the key length, in bits.
Returns:
an array containing the generated public and private key.
See Also:
PRIVKEY_INDEX, PUBKEY_INDEX

generateKeyPairs

public static final Key[][] generateKeyPairs(int num,
                                             String pub_alg,
                                             int key_length)
                                      throws SPKIException
generate and return a specifiable number of key-pairs.
Parameters:
num - the number of key-pairs to generate.
pub_alg - the public-key algorithm to use.
key_length - the key length, in bits.
Returns:
an array of generated key-pairs.
See Also:
PRIVKEY_INDEX, PUBKEY_INDEX