examples

Class GenerateKeyPair

    • Constructor Summary

      Constructors 
      Constructor and Description
      GenerateKeyPair() 
    • Method Summary

      Methods 
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenerateKeyPair

        public GenerateKeyPair()
    • Method Detail

      • generateKeyPair

        public static java.security.KeyPair generateKeyPair(java.lang.String alg,
                                            int bits,
                                            java.security.SecureRandom rand)
                                                     throws java.security.NoSuchAlgorithmException
        Actually generate the key pair
        Parameters:
        alg - algorithm to generate for (RSA or DSA)
        bits - key size
        rand - random number source
        Throws:
        java.security.NoSuchAlgorithmException
      • saveKeyPair

        public 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
        Save the given keypair to a file.
        Throws:
        java.io.IOException
        SSH2Exception
      • main

        public static void main(java.lang.String[] argv)
        Run the application