java.lang.Object
com.jcraft.jsch.KeyPair
- Direct Known Subclasses:
KeyPairDeferred
,KeyPairDSA
,KeyPairECDSA
,KeyPairEdDSA
,KeyPairPKCS8
,KeyPairRSA
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
decrypt(byte[] _passphrase)
boolean
void
dispose()
void
finalize()
abstract byte[]
static KeyPair
genKeyPair(JSch jsch, int type)
static KeyPair
genKeyPair(JSch jsch, int type, int key_size)
Returns the finger-print of the public key.abstract int
byte[]
Returns the blob of the public key.abstract byte[]
getSignature(byte[] data)
abstract byte[]
getSignature(byte[] data, String alg)
abstract Signature
abstract Signature
getVerifier(String alg)
boolean
static KeyPair
static KeyPair
static KeyPair
void
setPassphrase(byte[] passphrase)
Deprecated.use #writePrivateKey(String name, byte[] passphrase)void
setPassphrase(String passphrase)
Deprecated.use #writePrivateKey(OutputStream out, byte[] passphrase)void
setPublicKeyComment(String publicKeyComment)
void
writePrivateKey(OutputStream out)
Writes the plain private key to the given output stream.void
writePrivateKey(OutputStream out, byte[] passphrase)
Writes the cyphered private key to the given output stream.void
writePrivateKey(String name)
Writes the plain private key to the file.void
writePrivateKey(String name, byte[] passphrase)
Writes the cyphered private key to the file.void
writePublicKey(OutputStream out, String comment)
Writes the public key with the specified comment to the output stream.void
writePublicKey(String name, String comment)
Writes the public key with the specified comment to the file.void
writeSECSHPublicKey(OutputStream out, 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.txtvoid
writeSECSHPublicKey(String name, 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
-
Field Details
-
DEFERRED
public static final int DEFERRED- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR- See Also:
- Constant Field Values
-
DSA
public static final int DSA- See Also:
- Constant Field Values
-
RSA
public static final int RSA- See Also:
- Constant Field Values
-
ECDSA
public static final int ECDSA- See Also:
- Constant Field Values
-
UNKNOWN
public static final int UNKNOWN- See Also:
- Constant Field Values
-
ED25519
public static final int ED25519- See Also:
- Constant Field Values
-
ED448
public static final int ED448- See Also:
- Constant Field Values
-
publicKeyComment
-
cipher
-
kdfName
-
kdfOptions
protected byte[] kdfOptions -
encrypted
protected boolean encrypted -
data
protected byte[] data
-
-
Constructor Details
-
KeyPair
-
-
Method Details
-
genKeyPair
- Throws:
JSchException
-
genKeyPair
- Throws:
JSchException
-
getSignature
public abstract byte[] getSignature(byte[] data) -
getSignature
-
getVerifier
-
getVerifier
-
forSSHAgent
- Throws:
JSchException
-
getPublicKeyComment
-
setPublicKeyComment
-
writePrivateKey
Writes the plain private key to the given output stream.- Parameters:
out
- output stream- See Also:
writePrivateKey(OutputStream out, byte[] passphrase)
-
writePrivateKey
Writes the cyphered private key to the given output stream.- Parameters:
out
- output streampassphrase
- a passphrase to encrypt the private key
-
getKeyType
public abstract int getKeyType() -
getPublicKeyBlob
public byte[] getPublicKeyBlob()Returns the blob of the public key.- Returns:
- blob of the public key
-
writePublicKey
Writes the public key with the specified comment to the output stream.- Parameters:
out
- output streamcomment
- comment
-
writePublicKey
Writes the public key with the specified comment to the file.- Parameters:
name
- file namecomment
- comment- Throws:
FileNotFoundException
IOException
- See Also:
writePublicKey(OutputStream out, String comment)
-
writeSECSHPublicKey
Writes the public key with the specified comment to the output stream in the format defined in http://www.ietf.org/rfc/rfc4716.txt- Parameters:
out
- output streamcomment
- comment
-
writeSECSHPublicKey
public void writeSECSHPublicKey(String name, String comment) throws FileNotFoundException, IOExceptionWrites the public key with the specified comment to the output stream in the format defined in http://www.ietf.org/rfc/rfc4716.txt- Parameters:
name
- file namecomment
- comment- Throws:
FileNotFoundException
IOException
- See Also:
writeSECSHPublicKey(OutputStream out, String comment)
-
writePrivateKey
Writes the plain private key to the file.- Parameters:
name
- file name- Throws:
FileNotFoundException
IOException
- See Also:
writePrivateKey(String name, byte[] passphrase)
-
writePrivateKey
public void writePrivateKey(String name, byte[] passphrase) throws FileNotFoundException, IOExceptionWrites the cyphered private key to the file.- Parameters:
name
- file namepassphrase
- a passphrase to encrypt the private key- Throws:
FileNotFoundException
IOException
- See Also:
writePrivateKey(OutputStream out, byte[] passphrase)
-
getFingerPrint
Returns the finger-print of the public key.- Returns:
- finger print
-
setPassphrase
Deprecated.use #writePrivateKey(OutputStream out, byte[] passphrase) -
setPassphrase
Deprecated.use #writePrivateKey(String name, byte[] passphrase) -
isEncrypted
public boolean isEncrypted() -
decrypt
-
decrypt
public boolean decrypt(byte[] _passphrase) -
load
- Throws:
JSchException
-
load
- Throws:
JSchException
-
load
- Throws:
JSchException
-
dispose
public void dispose() -
finalize
public void finalize()
-