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 protected
SshPrivateKeyFile(byte[] keyblob, SshPrivateKeyFormat format)
Creates a new SshPrivateKeyFile object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changePassphrase(java.lang.String oldPassphrase, java.lang.String newPassphrase)
static SshPrivateKeyFile
create(SshPrivateKey key, java.lang.String passphrase, SshPrivateKeyFormat format)
byte[]
getBytes()
SshPrivateKeyFormat
getFormat()
byte[]
getKeyBlob(java.lang.String passphrase)
boolean
isPassphraseProtected()
static SshPrivateKeyFile
parse(byte[] formattedKey)
static SshPrivateKeyFile
parse(java.io.File keyfile)
void
setFormat(SshPrivateKeyFormat newFormat, java.lang.String passphrase)
SshPrivateKey
toPrivateKey(java.lang.String passphrase)
java.lang.String
toString()
-
-
-
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:
InvalidSshKeyException
java.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:
toString
in classjava.lang.Object
- Returns:
-
-