/** * Create default instance of jsch * * @param fs * the file system abstraction which will be necessary to perform * certain file system operations. * @return the new default JSch implementation. * @throws com.jcraft.jsch.JSchException * known host keys cannot be loaded. */ protected JSch createDefaultJSch(FS fs) throws JSchException { final JSch jsch = new JSch(); JSch.setConfig("ssh-rsa", JSch.getConfig("signature.rsa")); //$NON-NLS-1$ //$NON-NLS-2$ JSch.setConfig("ssh-dss", JSch.getConfig("signature.dss")); //$NON-NLS-1$ //$NON-NLS-2$ configureJSch(jsch); knownHosts(jsch, fs); identities(jsch, fs); return jsch; }
public String getConfig(String key){ Object foo=null; if(config!=null){ foo=config.get(key); if(foo instanceof String) return (String)foo; } foo=jsch.getConfig(key); if(foo instanceof String) return (String)foo; return null; }
public String getConfig(String key){ Object foo=null; if(config!=null){ foo=config.get(key); if(foo instanceof String) return (String)foo; } foo=jsch.getConfig(key); if(foo instanceof String) return (String)foo; return null; }
public String getConfig(String key){ Object foo=null; if(config!=null){ foo=config.get(key); if(foo instanceof String) return (String)foo; } foo=jsch.getConfig(key); if(foo instanceof String) return (String)foo; return null; }
private Cipher genCipher(){ try{ Class c; c=Class.forName(jsch.getConfig("3des-cbc")); cipher=(Cipher)(c.newInstance()); } catch(Exception e){ } return cipher; }
private Cipher genCipher(){ try{ Class c; c=Class.forName(jsch.getConfig("3des-cbc")); cipher=(Cipher)(c.newInstance()); } catch(Exception e){ } return cipher; }
private Cipher genCipher() { try { Class<?> c; c = Class.forName(JSch.getConfig("3des-cbc")); cipher = (Cipher) (c.newInstance()); } catch (Exception e) { } return cipher; }
private MAC getHMACSHA1(){ if(hmacsha1==null){ try{ Class c=Class.forName(jsch.getConfig("hmac-sha1")); hmacsha1=(MAC)(c.newInstance()); } catch(Exception e){ System.err.println("hmacsha1: "+e); } } return hmacsha1; }
private Random genRandom(){ if(random==null){ try{ Class c=Class.forName(jsch.getConfig("random")); random=(Random)(c.newInstance()); } catch(Exception e){ System.err.println("connect: random "+e); } } return random; }
private MAC getHMACSHA1(){ if(hmacsha1==null){ try{ Class c=Class.forName(jsch.getConfig("hmac-sha1")); hmacsha1=(MAC)(c.newInstance()); } catch(Exception e){ System.err.println("hmacsha1: "+e); } } return hmacsha1; }
private MAC getHMACSHA1() { if (hmacsha1 == null) { try { Class<?> c = Class.forName(JSch.getConfig("hmac-sha1")); hmacsha1 = (MAC) (c.newInstance()); } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); } } return hmacsha1; }
private Random genRandom(){ if(random==null){ try{ Class c=Class.forName(jsch.getConfig("random")); random=(Random)(c.newInstance()); } catch(Exception e){ System.err.println("connect: random "+e); } } return random; }
private MAC getHMACSHA1(){ if(hmacsha1==null){ try{ Class c=Class.forName(jsch.getConfig("hmac-sha1")); hmacsha1=(MAC)(c.newInstance()); } catch(Exception e){ System.err.println("hmacsha1: "+e); } } return hmacsha1; }
private Random genRandom() { if (random == null) { try { Class<?> c = Class.forName(JSch.getConfig("random")); random = (Random) (c.newInstance()); } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); } } return random; }
private HASH genHash(){ try{ Class c=Class.forName(jsch.getConfig("md5")); hash=(HASH)(c.newInstance()); hash.init(); } catch(Exception e){ } return hash; } private Cipher genCipher(){
private HASH genHash() { try { Class<?> c = Class.forName(JSch.getConfig("md5")); hash = (HASH) (c.newInstance()); hash.init(); } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); } return hash; }
private HASH genHash(){ try{ Class c=Class.forName(jsch.getConfig("md5")); hash=(HASH)(c.newInstance()); hash.init(); } catch(Exception e){ } return hash; } private Cipher genCipher(){
public String getFingerPrint(JSch jsch){ HASH hash=null; try{ Class c=Class.forName(jsch.getConfig("md5")); hash=(HASH)(c.newInstance()); } catch(Exception e){ System.err.println("getFingerPrint: "+e); } return Util.getFingerPrint(hash, key); } public String getComment(){ return comment; }
public String getFingerPrint(JSch jsch) { HASH hash = null; try { Class<?> c = Class.forName(JSch.getConfig("md5")); hash = (HASH) (c.newInstance()); } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); } return Util.getFingerPrint(hash, key); }
private void checkConfig(String cipher, String name, String key) { checkFirstConnection(); String[] split = JSch.getConfig(key).split(","); List ciphers = new ArrayList(Arrays.asList(split)); ciphers.remove(cipher); ciphers.add(0, cipher); String delimited = Util.toDelimited((String[]) ciphers.toArray(new String[ciphers.size()]), ','); JSch.setConfig(key, delimited); }