| Method from com.jcraft.jsch.JSch Detail: |
public void addIdentity(String prvkey) throws JSchException {
addIdentity(prvkey, (byte[])null);
}
|
public void addIdentity(String prvkey,
String passphrase) throws JSchException {
byte[] _passphrase=null;
if(passphrase!=null){
_passphrase=Util.str2byte(passphrase);
}
addIdentity(prvkey, _passphrase);
if(_passphrase!=null)
Util.bzero(_passphrase);
}
|
public void addIdentity(String prvkey,
byte[] passphrase) throws JSchException {
Identity identity=IdentityFile.newInstance(prvkey, null, this);
addIdentity(identity, passphrase);
}
|
public void addIdentity(Identity identity,
byte[] passphrase) throws JSchException {
if(passphrase!=null){
try{
byte[] goo=new byte[passphrase.length];
System.arraycopy(passphrase, 0, goo, 0, passphrase.length);
passphrase=goo;
identity.setPassphrase(passphrase);
}
finally{
Util.bzero(passphrase);
}
}
synchronized(identities){
if(!identities.contains(identity)){
identities.addElement(identity);
}
}
}
|
public void addIdentity(String prvkey,
String pubkey,
byte[] passphrase) throws JSchException {
Identity identity=IdentityFile.newInstance(prvkey, pubkey, this);
addIdentity(identity, passphrase);
}
|
public void addIdentity(String name,
byte[] prvkey,
byte[] pubkey,
byte[] passphrase) throws JSchException {
Identity identity=IdentityFile.newInstance(name, prvkey, pubkey, this);
addIdentity(identity, passphrase);
}
|
protected void addSession(Session session) {
synchronized(pool){
pool.addElement(session);
}
}
|
public static String getConfig(String key) {
synchronized(config){
return (String)(config.get(key));
}
}
|
public HostKeyRepository getHostKeyRepository() {
if(known_hosts==null) known_hosts=new KnownHosts(this);
return known_hosts;
}
|
public Vector getIdentityNames() throws JSchException {
Vector foo=new Vector();
synchronized(identities){
for(int i=0; i< identities.size(); i++){
Identity identity=(Identity)(identities.elementAt(i));
foo.addElement(identity.getName());
}
}
return foo;
}
|
static Logger getLogger() {
return logger;
}
|
public Session getSession(String username,
String host) throws JSchException {
return getSession(username, host, 22);
}
|
public Session getSession(String username,
String host,
int port) throws JSchException {
if(username==null){
throw new JSchException("username must not be null.");
}
if(host==null){
throw new JSchException("host must not be null.");
}
Session s=new Session(this);
s.setUserName(username);
s.setHost(host);
s.setPort(port);
//pool.addElement(s);
return s;
}
|
public void removeAllIdentity() throws JSchException {
synchronized(identities){
Vector foo=getIdentityNames();
for(int i=0; i< foo.size(); i++){
String name=((String)foo.elementAt(i));
removeIdentity(name);
}
}
}
|
public void removeIdentity(String name) throws JSchException {
synchronized(identities){
for(int i=0; i< identities.size(); i++){
Identity identity=(Identity)(identities.elementAt(i));
if(!identity.getName().equals(name))
continue;
identities.removeElement(identity);
identity.clear();
break;
}
}
}
|
protected boolean removeSession(Session session) {
synchronized(pool){
return pool.remove(session);
}
}
|
public static void setConfig(Hashtable newconf) {
synchronized(config){
for(java.util.Enumeration e=newconf.keys() ; e.hasMoreElements() ;) {
String key=(String)(e.nextElement());
config.put(key, (String)(newconf.get(key)));
}
}
}
|
public static void setConfig(String key,
String value) {
config.put(key, value);
}
|
public void setHostKeyRepository(HostKeyRepository hkrepo) {
known_hosts=hkrepo;
}
|
public void setKnownHosts(String filename) throws JSchException {
if(known_hosts==null) known_hosts=new KnownHosts(this);
if(known_hosts instanceof KnownHosts){
synchronized(known_hosts){
((KnownHosts)known_hosts).setKnownHosts(filename);
}
}
}
|
public void setKnownHosts(InputStream stream) throws JSchException {
if(known_hosts==null) known_hosts=new KnownHosts(this);
if(known_hosts instanceof KnownHosts){
synchronized(known_hosts){
((KnownHosts)known_hosts).setKnownHosts(stream);
}
}
}
|
public static void setLogger(Logger logger) {
if(logger==null) JSch.logger=DEVNULL;
JSch.logger=logger;
}
|