Package io.jenkins.blueocean.ssh
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 Summary
Constructors Constructor Description SSHKeyUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
encodePublicKey(RSAPublicKey key)
Encodes the public key according to some spec somewherestatic String
generateKey(int keySize)
Generates a new SSH private key with specified keySizestatic String
getPublicKey(String privateKey, String comment)
Gets the public key, with a comment for the given private key
-
-
-
Method Detail
-
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 usecomment
- 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
-
-