Class SSHKeyUtils

java.lang.Object
io.jenkins.blueocean.ssh.SSHKeyUtils

public class SSHKeyUtils extends Object
Utilities to generate a private key and perform necessary conversions on it
Author:
kzantow
  • Constructor Details

    • SSHKeyUtils

      public SSHKeyUtils()
  • Method Details

    • generateKey

      public static String generateKey(int keySize)
      Generates a new SSH private key with specified keySize
      Parameters:
      keySize - size to use for the key
      Returns:
      a SSH private key
    • getPublicKey

      public static String getPublicKey(String privateKey, String comment)
      Gets the public key, with a comment for the given private key
      Parameters:
      privateKey - SSH private key to use
      comment - comment with the key
      Returns:
      SSH public key
    • encodePublicKey

      public static byte[] encodePublicKey(RSAPublicKey key)
      Encodes the public key according to some spec somewhere
      Parameters:
      key - public key to use
      Returns:
      the ssh-rsa bytes