Package jenkins.plugins.jclouds.internal
Class SSHPublicKeyExtractor
- java.lang.Object
-
- jenkins.plugins.jclouds.internal.SSHPublicKeyExtractor
-
public final class SSHPublicKeyExtractor extends Object
Extracts a SSH public key from a SSH private key.- Author:
- Fritz Elfert
-
-
Constructor Summary
Constructors Constructor Description SSHPublicKeyExtractor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
extract(String pem, String passPhrase)
Extracts a SSH public key from a PEM-encoded SSH private key.
-
-
-
Method Detail
-
extract
public static String extract(String pem, String passPhrase) throws IOException
Extracts a SSH public key from a PEM-encoded SSH private key.- Parameters:
pem
- The PEM-encoded string (either RSA or DSA).passPhrase
- The passphrase to decrypt the private key (may be null, if the key is not encrypted).- Returns:
- A public key string in the form "<pubkey-type> <pubkey-base64>"
- Throws:
IOException
- if pem could not be decoded properly.
-
-