Interface SshPrivateKeyFile

All Known Implementing Classes:
OpenSSHPrivateKeyFile

public interface SshPrivateKeyFile
Interface which all private key formats must implement to provide decoding and decryption of the private key into a suitable format for the API.
Author:
Lee David Painter
  • Method Details

    • isPassphraseProtected

      boolean isPassphraseProtected()
      Determine if the private key file is protected by a passphrase.
      Returns:
      true if the key file is encrypted with a passphrase, otherwise false
      Throws:
      IOException
    • toKeyPair

      Decode the private key using the users passphrase.
      Parameters:
      passphrase - the users passphrase
      Returns:
      the key pair stored in this private key file.
      Throws:
      IOException
      InvalidPassphraseException
    • supportsPassphraseChange

      boolean supportsPassphraseChange()
      Method to determine whether the format supports changing of passphrases. This typically would indicate that the format is read-only and that keys cannot be saved into this format.
      Returns:
      boolean
    • getType

      String getType()
      Get a description of the format type e.g. "OpenSSH"
      Returns:
      String
    • changePassphrase

      void changePassphrase(String oldpassphrase, String newpassprase) throws IOException, InvalidPassphraseException
      Change the passphrase of the key file.
      Parameters:
      oldpassphrase - the old passphrase
      newpassprase - the new passphrase
      Throws:
      IOException
      InvalidPassphraseException
    • getFormattedKey

      byte[] getFormattedKey() throws IOException
      Get the formatted key
      Returns:
      byte[]
      Throws:
      IOException
    • getComment

      String getComment()
      The private key comment (if any).
      Returns: