Package ghidra.framework.remote.security

# Class SSHKeyManager

java.lang.Object
ghidra.framework.remote.security.SSHKeyManager

public class SSHKeyManager extends Object

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static org.bouncycastle.crypto.CipherParameters`
  `getSSHPrivateKey(File sshPrivateKeyFile)`
  Return the SSH private key corresponding to the specified key file.
  `static org.bouncycastle.crypto.CipherParameters`
  `getSSHPrivateKey(InputStream sshPrivateKeyIn)`
  Return the SSH private key corresponding to the specified key input stream.
  `static org.bouncycastle.crypto.CipherParameters`
  `getSSHPublicKey(File sshPublicKeyFile)`
  Attempt to instantiate an SSH public key from the specified file which contains a single public key.
  `static void`
  `setProtectedKeyStorePasswordProvider(KeyStorePasswordProvider provider)`
  Set PKI protected keystore password provider

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### setProtectedKeyStorePasswordProvider

    public static void setProtectedKeyStorePasswordProvider(KeyStorePasswordProvider provider)
    Set PKI protected keystore password provider
    Parameters:
      `provider` - key store password provider

  - ### getSSHPrivateKey

    public static org.bouncycastle.crypto.CipherParameters getSSHPrivateKey(File sshPrivateKeyFile) throws InvalidKeyException, IOException
    Return the SSH private key corresponding to the specified key file. If the specified key file is encrypted the currently installed password provider will be used to obtain the decrypt password.
    Parameters:
      `sshPrivateKeyFile` - private ssh key file
    Returns:
      private key cipher parameters (`RSAKeyParameters` or `DSAKeyParameters`)
    Throws:
      `FileNotFoundException` - key file not found
      `IOException` - if key file not found or key parse failed
      `InvalidKeyException` - if key is not an SSH private key (i.e., PEM format)

  - ### getSSHPrivateKey

    public static org.bouncycastle.crypto.CipherParameters getSSHPrivateKey(InputStream sshPrivateKeyIn) throws InvalidKeyException, IOException
    Return the SSH private key corresponding to the specified key input stream. If the specified key is encrypted the currently installed password provider will be used to obtain the decrypt password.
    Parameters:
      `sshPrivateKeyIn` - private ssh key resource input stream
    Returns:
      private key cipher parameters (`RSAKeyParameters` or `DSAKeyParameters`)
    Throws:
      `FileNotFoundException` - key file not found
      `IOException` - if key file not found or key parse failed
      `InvalidKeyException` - if key is not an SSH private key (i.e., PEM format)

  - ### getSSHPublicKey

    public static org.bouncycastle.crypto.CipherParameters getSSHPublicKey(File sshPublicKeyFile) throws IOException
    Attempt to instantiate an SSH public key from the specified file which contains a single public key.
    Parameters:
      `sshPublicKeyFile` - public ssh key file
    Returns:
      public key cipher parameters `RSAKeyParameters` or `DSAKeyParameters`
    Throws:
      `FileNotFoundException` - key file not found
      `IOException` - if key file not found or key parse failed