Class SshPrivateKeyFile
- java.lang.Object
-
- com.sshtools.j2ssh.transport.publickey.SshPrivateKeyFile
-
public class SshPrivateKeyFile extends java.lang.Object- Version:
- $Revision: 1.21 $
- Author:
- $author$
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSshPrivateKeyFile(byte[] keyblob, SshPrivateKeyFormat format)Creates a new SshPrivateKeyFile object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangePassphrase(java.lang.String oldPassphrase, java.lang.String newPassphrase)static SshPrivateKeyFilecreate(SshPrivateKey key, java.lang.String passphrase, SshPrivateKeyFormat format)byte[]getBytes()SshPrivateKeyFormatgetFormat()byte[]getKeyBlob(java.lang.String passphrase)booleanisPassphraseProtected()static SshPrivateKeyFileparse(byte[] formattedKey)static SshPrivateKeyFileparse(java.io.File keyfile)voidsetFormat(SshPrivateKeyFormat newFormat, java.lang.String passphrase)SshPrivateKeytoPrivateKey(java.lang.String passphrase)java.lang.StringtoString()
-
-
-
Constructor Detail
-
SshPrivateKeyFile
protected SshPrivateKeyFile(byte[] keyblob, SshPrivateKeyFormat format)Creates a new SshPrivateKeyFile object.- Parameters:
keyblob-format-
-
-
Method Detail
-
getBytes
public byte[] getBytes()
- Returns:
-
getKeyBlob
public byte[] getKeyBlob(java.lang.String passphrase) throws InvalidSshKeyException- Parameters:
passphrase-- Returns:
- Throws:
InvalidSshKeyException
-
changePassphrase
public void changePassphrase(java.lang.String oldPassphrase, java.lang.String newPassphrase) throws InvalidSshKeyException- Parameters:
oldPassphrase-newPassphrase-- Throws:
InvalidSshKeyException
-
parse
public static SshPrivateKeyFile parse(byte[] formattedKey) throws InvalidSshKeyException
- Parameters:
formattedKey-- Returns:
- Throws:
InvalidSshKeyException
-
parse
public static SshPrivateKeyFile parse(java.io.File keyfile) throws InvalidSshKeyException, java.io.IOException
- Parameters:
keyfile-- Returns:
- Throws:
InvalidSshKeyExceptionjava.io.IOException
-
isPassphraseProtected
public boolean isPassphraseProtected()
- Returns:
-
create
public static SshPrivateKeyFile create(SshPrivateKey key, java.lang.String passphrase, SshPrivateKeyFormat format) throws InvalidSshKeyException
- Throws:
InvalidSshKeyException
-
setFormat
public void setFormat(SshPrivateKeyFormat newFormat, java.lang.String passphrase) throws InvalidSshKeyException
- Parameters:
newFormat-passphrase-- Throws:
InvalidSshKeyException
-
getFormat
public SshPrivateKeyFormat getFormat()
- Returns:
-
toPrivateKey
public SshPrivateKey toPrivateKey(java.lang.String passphrase) throws InvalidSshKeyException
- Parameters:
passphrase-- Returns:
- Throws:
InvalidSshKeyException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
-
-