maspack.fileutil.jsch
Class KeyPair
java.lang.Object
maspack.fileutil.jsch.KeyPair
- Direct Known Subclasses:
- KeyPairDSA, KeyPairRSA
public abstract class KeyPair
- extends java.lang.Object
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
KeyPair
public KeyPair()
genKeyPair
public static KeyPair genKeyPair(int type)
throws com.jcraft.jsch.JSchException
- Throws:
com.jcraft.jsch.JSchException
genKeyPair
public static KeyPair genKeyPair(int type,
int key_size)
throws com.jcraft.jsch.JSchException
- Throws:
com.jcraft.jsch.JSchException
getSignature
public abstract byte[] getSignature(byte[] data)
getVerifier
public abstract com.jcraft.jsch.Signature getVerifier()
forSSHAgent
public abstract byte[] forSSHAgent()
throws com.jcraft.jsch.JSchException
- Throws:
com.jcraft.jsch.JSchException
getPublicKeyComment
public java.lang.String getPublicKeyComment()
setPublicKeyComment
public void setPublicKeyComment(java.lang.String publicKeyComment)
writePrivateKey
public void writePrivateKey(java.io.OutputStream out)
getKeyTypeName
public abstract byte[] getKeyTypeName()
getKeyType
public abstract int getKeyType()
getPublicKeyBlob
public byte[] getPublicKeyBlob()
writePublicKey
public void writePublicKey(java.io.OutputStream out,
java.lang.String comment)
writePublicKey
public void writePublicKey(java.lang.String name,
java.lang.String comment)
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
writeSECSHPublicKey
public void writeSECSHPublicKey(java.io.OutputStream out,
java.lang.String comment)
writeSECSHPublicKey
public void writeSECSHPublicKey(java.lang.String name,
java.lang.String comment)
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
writePrivateKey
public void writePrivateKey(java.lang.String name)
throws java.io.FileNotFoundException,
java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
getFingerPrint
public java.lang.String getFingerPrint()
setPassphrase
public void setPassphrase(java.lang.String passphrase)
setPassphrase
public void setPassphrase(byte[] passphrase)
isEncrypted
public boolean isEncrypted()
decrypt
public boolean decrypt(java.lang.String _passphrase)
decrypt
public boolean decrypt(byte[] _passphrase)
load
public static KeyPair load(java.lang.String prvkey)
throws com.jcraft.jsch.JSchException
- Throws:
com.jcraft.jsch.JSchException
load
public static KeyPair load(java.lang.String prvfile,
java.lang.String pubfile)
throws com.jcraft.jsch.JSchException
- Loads a key from a file
- Parameters:
prvfile
- pubfile
-
- Returns:
- loaded key pair
- Throws:
com.jcraft.jsch.JSchException
load
public static KeyPair load(java.io.File prvfile,
java.io.File pubfile)
throws com.jcraft.jsch.JSchException
- Loads a key from a file
- Parameters:
prvfile
- pubfile
-
- Returns:
- loaded key pair
- Throws:
com.jcraft.jsch.JSchException
load
public static KeyPair load(byte[] prvkey,
byte[] pubkey)
throws com.jcraft.jsch.JSchException
- Throws:
com.jcraft.jsch.JSchException
dispose
public void dispose()
finalize
public void finalize()
- Overrides:
finalize
in class java.lang.Object
loadPPK
public static KeyPair loadPPK(byte[] buf)
throws com.jcraft.jsch.JSchException
- Throws:
com.jcraft.jsch.JSchException