@Override protected Session createSession(Host hc, String user, String host, int port, FS fs) throws JSchException { if (sshKeysByHostname.containsKey(host)) { JGitEnvironmentProperties sshUriProperties = sshKeysByHostname.get(host); jSch.addIdentity(host, sshUriProperties.getPrivateKey().getBytes(), null, null); if (sshUriProperties.getKnownHostsFile() != null) { jSch.setKnownHosts(sshUriProperties.getKnownHostsFile()); } if (sshUriProperties.getHostKey() != null) { HostKey hostkey = new HostKey(host, Base64.decode(sshUriProperties.getHostKey())); jSch.getHostKeyRepository().add(hostkey, null); } return jSch.getSession(user, host, port); } throw new JSchException("no keys configured for hostname " + host); }
jsch.setConfigRepository(defaultJSch.getConfigRepository()); jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository()); jsch.addIdentity(identityKey); byIdentityFile.put(identityKey, jsch);
/** * Gets the hostkeyRepository. * If this.hostkeyRepository is <code>null</code>, * JSch#getHostKeyRepository() will be invoked. * * @see JSch#getHostKeyRepository() */ public HostKeyRepository getHostKeyRepository(){ if(hostkeyRepository == null) return jsch.getHostKeyRepository(); return hostkeyRepository; }
/** * Gets the hostkeyRepository. * If this.hostkeyRepository is <code>null</code>, * JSch#getHostKeyRepository() will be invoked. * * @see JSch#getHostKeyRepository() */ public HostKeyRepository getHostKeyRepository(){ if(hostkeyRepository == null) return jsch.getHostKeyRepository(); return hostkeyRepository; }
/** * Gets the hostkeyRepository. * If this.hostkeyRepository is <code>null</code>, * JSch#getHostKeyRepository() will be invoked. * * @see JSch#getHostKeyRepository() */ public HostKeyRepository getHostKeyRepository() { if (hostkeyRepository == null) { return jsch.getHostKeyRepository(); } return hostkeyRepository; }
/** * Gets the hostkeyRepository. * If this.hostkeyRepository is <code>null</code>, * JSch#getHostKeyRepository() will be invoked. * * @see JSch#getHostKeyRepository() */ public HostKeyRepository getHostKeyRepository(){ if(hostkeyRepository == null) return jsch.getHostKeyRepository(); return hostkeyRepository; }
public JschHostKeyManager(SshConfiguration configuration) throws SshException { super(configuration); jsch = new JSch(); // file = Util.getKnownHostsFile(configuration); if (file.exists()) { try { jsch.setKnownHosts(file.getAbsolutePath()); } catch (JSchException e) { throw new SshException(SshException.IO_ERROR, e); } } hkr = jsch.getHostKeyRepository(); }
jsch = new JSch(); configureJSch(jsch); jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository()); jsch.addIdentity(identityKey); byIdentityFile.put(identityKey, jsch);
jsch.setConfigRepository(defaultJSch.getConfigRepository()); jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository()); jsch.addIdentity(identityKey); byIdentityFile.put(identityKey, jsch);
HostKeyRepository hkr = jsch.getHostKeyRepository(); HostKey[] hks = hkr.getHostKey(); if (hks != null) {
HostKeyRepository hkr=jsch.getHostKeyRepository(); int i=0; synchronized(hkr){
client.setHostKeyRepository(new HostKeyRepositoryBridge(client.getHostKeyRepository())); session = client.getSession(username, hostname, port); final SocketFactory socketFactory = getConfiguration().getSocketFactory();
HostKeyRepository hkr = sch.getHostKeyRepository();
HostKeyRepository hkr = sch.getHostKeyRepository();