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 Details

    • SSHPublicKeyExtractor

      public SSHPublicKeyExtractor()
  • Method Details

    • 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.