com.sshtools.publickey
Interface SshPrivateKeyFile


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 Summary
 void changePassphrase(java.lang.String oldpassphrase, java.lang.String newpassprase)
          Change the passphrase of the key file.
 byte[] getFormattedKey()
          Get the formatted key
 java.lang.String getType()
          Get a description of the format type e.g.
 boolean isPassphraseProtected()
          Determine if the private key file is protected by a passphrase.
 boolean supportsPassphraseChange()
          Method to determine whether the format supports changing of passphrases.
 SshKeyPair toKeyPair(java.lang.String passphrase)
          Decode the private key using the users passphrase.
 

Method Detail

isPassphraseProtected

public 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:
java.io.IOException

toKeyPair

public SshKeyPair toKeyPair(java.lang.String passphrase)
                     throws java.io.IOException,
                            InvalidPassphraseException
Decode the private key using the users passphrase.

Parameters:
passphrase - the users passphrase
Returns:
the key pair stored in this private key file.
Throws:
java.io.IOException
InvalidPassphraseException

supportsPassphraseChange

public 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:

getType

public java.lang.String getType()
Get a description of the format type e.g. "OpenSSH"

Returns:

changePassphrase

public void changePassphrase(java.lang.String oldpassphrase,
                             java.lang.String newpassprase)
                      throws java.io.IOException,
                             InvalidPassphraseException
Change the passphrase of the key file.

Parameters:
oldpassphrase - the old passphrase
newpassprase - the new passphrase
Throws:
java.io.IOException
InvalidPassphraseException

getFormattedKey

public byte[] getFormattedKey()
                       throws java.io.IOException
Get the formatted key

Returns:
Throws:
java.io.IOException


Copyright © 2003 3SP LTD. All Rights Reserved.