Package com.jcraft.jsch
Class IdentityFile
- java.lang.Object
-
- com.jcraft.jsch.IdentityFile
-
-
Constructor Summary
Constructors Modifier Constructor Description private
IdentityFile(JSch jsch, java.lang.String name, KeyPair kpair)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear()
Disposes internally allocated data, like byte array for the private key.boolean
decrypt()
Deprecated.This method should not be invoked.java.lang.String
getAlgName()
Returns the name of the key algorithm.KeyPair
getKeyPair()
java.lang.String
getName()
Returns the name of this identity.byte[]
getPublicKeyBlob()
Returns the public-key blob.byte[]
getSignature(byte[] data)
Signs on data with this identity, and returns the result.boolean
isEncrypted()
Returns true if this identity is cyphered.(package private) static IdentityFile
newInstance(java.lang.String name, byte[] prvkey, byte[] pubkey, JSch jsch)
(package private) static IdentityFile
newInstance(java.lang.String prvfile, java.lang.String pubfile, JSch jsch)
boolean
setPassphrase(byte[] passphrase)
Decrypts this identity with the specified pass-phrase.
-
-
-
Constructor Detail
-
IdentityFile
private IdentityFile(JSch jsch, java.lang.String name, KeyPair kpair) throws JSchException
- Throws:
JSchException
-
-
Method Detail
-
newInstance
static IdentityFile newInstance(java.lang.String prvfile, java.lang.String pubfile, JSch jsch) throws JSchException
- Throws:
JSchException
-
newInstance
static IdentityFile newInstance(java.lang.String name, byte[] prvkey, byte[] pubkey, JSch jsch) throws JSchException
- Throws:
JSchException
-
setPassphrase
public boolean setPassphrase(byte[] passphrase) throws JSchException
Decrypts this identity with the specified pass-phrase.- Specified by:
setPassphrase
in interfaceIdentity
- Parameters:
passphrase
- the pass-phrase for this identity.- Returns:
- true if the decryption is succeeded or this identity is not cyphered.
- Throws:
JSchException
-
getPublicKeyBlob
public byte[] getPublicKeyBlob()
Returns the public-key blob.- Specified by:
getPublicKeyBlob
in interfaceIdentity
- Returns:
- the public-key blob
-
getSignature
public byte[] getSignature(byte[] data)
Signs on data with this identity, and returns the result.- Specified by:
getSignature
in interfaceIdentity
- Parameters:
data
- data to be signed- Returns:
- the signature
-
decrypt
public boolean decrypt()
Deprecated.This method should not be invoked.- Specified by:
decrypt
in interfaceIdentity
- See Also:
setPassphrase(byte[] passphrase)
-
getAlgName
public java.lang.String getAlgName()
Returns the name of the key algorithm.- Specified by:
getAlgName
in interfaceIdentity
- Returns:
- "ssh-rsa" or "ssh-dss"
-
getName
public java.lang.String getName()
Returns the name of this identity. It will be useful to identify this object in theIdentityRepository
.
-
isEncrypted
public boolean isEncrypted()
Returns true if this identity is cyphered.- Specified by:
isEncrypted
in interfaceIdentity
- Returns:
- true if this identity is cyphered.
-
clear
public void clear()
Disposes internally allocated data, like byte array for the private key.
-
-