examples
public class GenerateKeyPair extends java.lang.Object
Usage:
The definition file is a standard Java property file which should
contain the following properties:
java -cp examples.jar examples.GenerateKeyPair
definition_file
openssh and
sshinc. The default value is openssh.RSA and DSA. The default value is RSA..pub
| Constructor and Description |
|---|
GenerateKeyPair() |
| Modifier and Type | Method and Description |
|---|---|
static java.security.KeyPair |
generateKeyPair(java.lang.String alg,
int bits,
java.security.SecureRandom rand)
Actually generate the key pair
|
static void |
main(java.lang.String[] argv)
Run the application
|
static void |
saveKeyPair(java.security.KeyPair kp,
java.lang.String passwd,
java.lang.String fileName,
java.lang.String subject,
java.lang.String comment,
boolean sshComFormat,
java.security.SecureRandom rand)
Save the given keypair to a file.
|
public static java.security.KeyPair generateKeyPair(java.lang.String alg,
int bits,
java.security.SecureRandom rand)
throws java.security.NoSuchAlgorithmException
alg - algorithm to generate for (RSA or DSA)bits - key sizerand - random number sourcejava.security.NoSuchAlgorithmExceptionpublic static void saveKeyPair(java.security.KeyPair kp,
java.lang.String passwd,
java.lang.String fileName,
java.lang.String subject,
java.lang.String comment,
boolean sshComFormat,
java.security.SecureRandom rand)
throws java.io.IOException,
SSH2Exception
java.io.IOExceptionSSH2Exceptionpublic static void main(java.lang.String[] argv)