public abstract class KeyPair
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DSA |
static int |
ERROR |
static int |
RSA |
static int |
UNKNOWN |
Constructor and Description |
---|
KeyPair() |
Modifier and Type | Method and Description |
---|---|
boolean |
decrypt(byte[] _passphrase) |
boolean |
decrypt(java.lang.String _passphrase) |
void |
dispose() |
void |
finalize() |
abstract byte[] |
forSSHAgent() |
static KeyPair |
genKeyPair(int type) |
static KeyPair |
genKeyPair(int type,
int key_size) |
java.lang.String |
getFingerPrint() |
abstract int |
getKeyType() |
abstract byte[] |
getKeyTypeName() |
byte[] |
getPublicKeyBlob() |
java.lang.String |
getPublicKeyComment() |
abstract byte[] |
getSignature(byte[] data) |
abstract com.jcraft.jsch.Signature |
getVerifier() |
boolean |
isEncrypted() |
static KeyPair |
load(byte[] prvkey,
byte[] pubkey) |
static KeyPair |
load(java.io.File prvfile,
java.io.File pubfile)
Loads a key from a file
|
static KeyPair |
load(java.lang.String prvkey) |
static KeyPair |
load(java.lang.String prvfile,
java.lang.String pubfile)
Loads a key from a file
|
static KeyPair |
loadPPK(byte[] buf) |
void |
setPassphrase(byte[] passphrase) |
void |
setPassphrase(java.lang.String passphrase) |
void |
setPublicKeyComment(java.lang.String publicKeyComment) |
void |
writePrivateKey(java.io.OutputStream out) |
void |
writePrivateKey(java.lang.String name) |
void |
writePublicKey(java.io.OutputStream out,
java.lang.String comment) |
void |
writePublicKey(java.lang.String name,
java.lang.String comment) |
void |
writeSECSHPublicKey(java.io.OutputStream out,
java.lang.String comment) |
void |
writeSECSHPublicKey(java.lang.String name,
java.lang.String comment) |
public static final int ERROR
public static final int DSA
public static final int RSA
public static final int UNKNOWN
public static KeyPair genKeyPair(int type) throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException
public static KeyPair genKeyPair(int type, int key_size) throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException
public abstract byte[] getSignature(byte[] data)
public abstract com.jcraft.jsch.Signature getVerifier()
public abstract byte[] forSSHAgent() throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException
public java.lang.String getPublicKeyComment()
public void setPublicKeyComment(java.lang.String publicKeyComment)
public void writePrivateKey(java.io.OutputStream out)
public abstract byte[] getKeyTypeName()
public abstract int getKeyType()
public byte[] getPublicKeyBlob()
public void writePublicKey(java.io.OutputStream out, java.lang.String comment)
public void writePublicKey(java.lang.String name, java.lang.String comment) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public void writeSECSHPublicKey(java.io.OutputStream out, java.lang.String comment)
public void writeSECSHPublicKey(java.lang.String name, java.lang.String comment) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public void writePrivateKey(java.lang.String name) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public java.lang.String getFingerPrint()
public void setPassphrase(java.lang.String passphrase)
public void setPassphrase(byte[] passphrase)
public boolean isEncrypted()
public boolean decrypt(java.lang.String _passphrase)
public boolean decrypt(byte[] _passphrase)
public static KeyPair load(java.lang.String prvkey) throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException
public static KeyPair load(java.lang.String prvfile, java.lang.String pubfile) throws com.jcraft.jsch.JSchException
prvfile
- private key filepubfile
- public key filecom.jcraft.jsch.JSchException
public static KeyPair load(java.io.File prvfile, java.io.File pubfile) throws com.jcraft.jsch.JSchException
prvfile
- private key filepubfile
- public key filecom.jcraft.jsch.JSchException
public static KeyPair load(byte[] prvkey, byte[] pubkey) throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException
public void dispose()
public void finalize()
finalize
in class java.lang.Object
public static KeyPair loadPPK(byte[] buf) throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException