atg.nucleus
Class KeyGenerator

java.lang.Object
  extended by atg.nucleus.KeyGenerator

public class KeyGenerator
extends java.lang.Object

This class contains utility methods for generating public and private keys for DSA signing.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
KeyGenerator()
           
 
Method Summary
static java.security.KeyPair generateKeyPair()
          Generates a new public/private key pair with a default strength of 1024.
static java.security.KeyPair generateKeyPair(int pStrength)
          Generates a new public/private key pair usable for DSA signing.
static void main(java.lang.String[] pArgs)
          Runs the main key generator.
static java.lang.String serializeKey(java.security.Key pKey)
          This returns the specified key, serialized and converted to a hexadecimal string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

KeyGenerator

public KeyGenerator()
Method Detail

generateKeyPair

public static java.security.KeyPair generateKeyPair(int pStrength)
                                             throws java.security.NoSuchAlgorithmException
Generates a new public/private key pair usable for DSA signing.

Parameters:
pStrength - the length, in bits, of the modulus. This can be any integral multiple of 8 greater than or equal to 512. Typical values are 512, 768, and 1024.
Throws:
java.security.NoSuchAlgorithmException

generateKeyPair

public static java.security.KeyPair generateKeyPair()
                                             throws java.security.NoSuchAlgorithmException
Generates a new public/private key pair with a default strength of 1024.

Throws:
java.security.NoSuchAlgorithmException

serializeKey

public static java.lang.String serializeKey(java.security.Key pKey)
                                     throws java.io.IOException
This returns the specified key, serialized and converted to a hexadecimal string.

Throws:
java.io.IOException

main

public static void main(java.lang.String[] pArgs)
                 throws java.security.NoSuchAlgorithmException,
                        java.io.IOException
Runs the main key generator. An optional argument is the strength of the keys to be generated.

Throws:
java.security.NoSuchAlgorithmException
java.io.IOException