public abstract class KeyPair
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
protected byte[] |
data |
static int |
DSA |
static int |
ECDSA |
protected boolean |
encrypted |
static int |
ERROR |
protected java.lang.String |
publicKeyComment |
static int |
RSA |
static int |
UNKNOWN |
限定符和类型 | 方法和说明 |
---|---|
boolean |
decrypt(byte[] _passphrase) |
boolean |
decrypt(java.lang.String _passphrase) |
void |
dispose() |
void |
finalize() |
abstract byte[] |
forSSHAgent() |
static KeyPair |
genKeyPair(JSch jsch,
int type) |
static KeyPair |
genKeyPair(JSch jsch,
int type,
int key_size) |
java.lang.String |
getFingerPrint()
Returns the finger-print of the public key.
|
abstract int |
getKeyType() |
byte[] |
getPublicKeyBlob()
Returns the blob of the public key.
|
java.lang.String |
getPublicKeyComment() |
abstract byte[] |
getSignature(byte[] data) |
abstract Signature |
getVerifier() |
boolean |
isEncrypted() |
static KeyPair |
load(JSch jsch,
byte[] prvkey,
byte[] pubkey) |
static KeyPair |
load(JSch jsch,
java.lang.String prvkey) |
static KeyPair |
load(JSch jsch,
java.lang.String prvfile,
java.lang.String pubfile) |
void |
setPassphrase(byte[] passphrase)
已过时。
use #writePrivateKey(String name, byte[] passphrase)
|
void |
setPassphrase(java.lang.String passphrase)
已过时。
use #writePrivateKey(java.io.OutputStream out, byte[] passphrase)
|
void |
setPublicKeyComment(java.lang.String publicKeyComment) |
void |
writePrivateKey(java.io.OutputStream out)
Writes the plain private key to the given output stream.
|
void |
writePrivateKey(java.io.OutputStream out,
byte[] passphrase)
Writes the cyphered private key to the given output stream.
|
void |
writePrivateKey(java.lang.String name)
Writes the plain private key to the file.
|
void |
writePrivateKey(java.lang.String name,
byte[] passphrase)
Writes the cyphered private key to the file.
|
void |
writePublicKey(java.io.OutputStream out,
java.lang.String comment)
Writes the public key with the specified comment to the output stream.
|
void |
writePublicKey(java.lang.String name,
java.lang.String comment)
Writes the public key with the specified comment to the file.
|
void |
writeSECSHPublicKey(java.io.OutputStream out,
java.lang.String comment)
Writes the public key with the specified comment to the output stream in
the format defined in http://www.ietf.org/rfc/rfc4716.txt
|
void |
writeSECSHPublicKey(java.lang.String name,
java.lang.String comment)
Writes the public key with the specified comment to the output stream in
the format defined in http://www.ietf.org/rfc/rfc4716.txt
|
public static final int ERROR
public static final int DSA
public static final int RSA
public static final int ECDSA
public static final int UNKNOWN
protected java.lang.String publicKeyComment
protected boolean encrypted
protected byte[] data
public KeyPair(JSch jsch)
public static KeyPair genKeyPair(JSch jsch, int type) throws JSchException
JSchException
public static KeyPair genKeyPair(JSch jsch, int type, int key_size) throws JSchException
JSchException
public abstract byte[] getSignature(byte[] data)
public abstract Signature getVerifier()
public abstract byte[] forSSHAgent() throws JSchException
JSchException
public java.lang.String getPublicKeyComment()
public void setPublicKeyComment(java.lang.String publicKeyComment)
public void writePrivateKey(java.io.OutputStream out)
out
- output streamwritePrivateKey(java.io.OutputStream out, byte[] passphrase)
public void writePrivateKey(java.io.OutputStream out, byte[] passphrase)
out
- output streampassphrase
- a passphrase to encrypt the private keypublic abstract int getKeyType()
public byte[] getPublicKeyBlob()
public void writePublicKey(java.io.OutputStream out, java.lang.String comment)
out
- output streamcomment
- commentpublic void writePublicKey(java.lang.String name, java.lang.String comment) throws java.io.FileNotFoundException, java.io.IOException
name
- file namecomment
- commentjava.io.FileNotFoundException
java.io.IOException
writePublicKey(java.io.OutputStream out, String comment)
public void writeSECSHPublicKey(java.io.OutputStream out, java.lang.String comment)
out
- output streamcomment
- commentpublic void writeSECSHPublicKey(java.lang.String name, java.lang.String comment) throws java.io.FileNotFoundException, java.io.IOException
name
- file namecomment
- commentjava.io.FileNotFoundException
java.io.IOException
writeSECSHPublicKey(java.io.OutputStream out, String comment)
public void writePrivateKey(java.lang.String name) throws java.io.FileNotFoundException, java.io.IOException
name
- file namejava.io.FileNotFoundException
java.io.IOException
writePrivateKey(String name, byte[] passphrase)
public void writePrivateKey(java.lang.String name, byte[] passphrase) throws java.io.FileNotFoundException, java.io.IOException
name
- file namepassphrase
- a passphrase to encrypt the private keyjava.io.FileNotFoundException
java.io.IOException
writePrivateKey(java.io.OutputStream out, byte[] passphrase)
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(JSch jsch, java.lang.String prvkey) throws JSchException
JSchException
public static KeyPair load(JSch jsch, java.lang.String prvfile, java.lang.String pubfile) throws JSchException
JSchException
public static KeyPair load(JSch jsch, byte[] prvkey, byte[] pubkey) throws JSchException
JSchException
public void dispose()
public void finalize()
finalize
在类中 java.lang.Object