|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tribble.security.GenKeyPair
Public/private key pair generator. Generates a public/private key pair to be used for asymmetric (public key) encryption.
The public and private keys are written to text files formatted as XML.
These key files can then be read by class KeyReader
.
KeyReader
Field Summary | |
static java.lang.String |
DFL_ALGORITHM
Default key pair generation algorithm ("RSA"). |
static int |
DFL_KEYSIZE
Default key pair bit size (1024). |
Constructor Summary | |
GenKeyPair()
Default constructor. |
|
GenKeyPair(java.lang.String algo,
int size)
Constructor. |
Method Summary | |
java.security.KeyPair |
generate()
Generate a public/private key pair. |
static void |
main(java.lang.String[] args)
Generate a public/private encryption key pair. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DFL_ALGORITHM
public static final int DFL_KEYSIZE
Constructor Detail |
public GenKeyPair() throws java.security.GeneralSecurityException
java.security.NoSuchAlgorithmException
- Thrown if the default generator algorithm is not available.
java.security.GeneralSecurityException
public GenKeyPair(java.lang.String algo, int size) throws java.security.GeneralSecurityException
algo
- Name of the public/private key pair generation algorithm to use, e.g.,
"DSA".size
- Key size (in bits), e.g., 1024.
java.security.NoSuchAlgorithmException
- Thrown if the specified generator algorithm is not available.
java.security.GeneralSecurityException
Method Detail |
public static void main(java.lang.String[] args) throws java.io.IOException, java.security.GeneralSecurityException
Usage java tribble.security.GenKeyPair [-option...] public.xml private.xml
Options:
Writes the public half of the generated key pair to file public.xml, and the private half to file private.xml. The output files are in stand-alone XML format.
java.security.GeneralSecurityException
- Thrown if a security exception occurs.
java.io.IOException
- Thrown if and I/O (write) error occurs.public java.security.KeyPair generate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |