public class KeyGenerator
extends java.lang.Object
This class contains utility methods for generating public and private keys for DSA signing.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
| Constructor and Description |
|---|
KeyGenerator() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static java.security.KeyPair generateKeyPair(int pStrength)
throws java.security.NoSuchAlgorithmException
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.java.security.NoSuchAlgorithmExceptionpublic static java.security.KeyPair generateKeyPair()
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionpublic static java.lang.String serializeKey(java.security.Key pKey)
throws java.io.IOException
java.io.IOExceptionpublic static void main(java.lang.String[] pArgs)
throws java.security.NoSuchAlgorithmException,
java.io.IOException
java.security.NoSuchAlgorithmExceptionjava.io.IOException