public ProxyConnectionDetails(String proxyHost, int proxyPort, String proxyUsername, String proxyPassword) { this(proxyHost, proxyPort); this.setProxyUsername(proxyUsername); this.setProxyPassword(proxyPassword); }
public KeyData(String privateKeyData) { this.setPrivateKeyData(privateKeyData); this.passPhrase = null; this.setKeyName(); }
public ProxyConnectionDetails(String proxyHost, int proxyPort) { this.setProxyHost(proxyHost); this.setProxyPort(proxyPort); }
public static void setIdentity(JSch jsch, IdentityKey identityKey) throws SSHException { byte[] passPhrase = identityKey.getPassPhrase(); if (identityKey instanceof KeyFile) { try { jsch.addIdentity(((KeyFile) identityKey).getKeyFilePath(), passPhrase); } catch (JSchException e) { throw new SSHException("The keyFilePath is invalid.", e); } } else { try { jsch.addIdentity(((KeyData) identityKey).getKeyName(), ((KeyData) identityKey).getPrivateKeyData(), null, passPhrase); } catch (JSchException e) { throw new SSHException("The " + Constants.PRIVATE_KEY_DATA + " is invalid.", e); } } } }
public static IdentityKey getIdentityKey(String privateKeyFile, String privateKeyString, String privateKeyPassphrase) { IdentityKey identityKey = null; if (StringUtilities.isNotEmpty(privateKeyFile)) { identityKey = new KeyFile(privateKeyFile); } if (StringUtilities.isNotEmpty(privateKeyString)) { if (identityKey != null) { throw new IllegalArgumentException(String.format("%s and %s inputs are mutually exclusive. They can't be both set at the same time.", Constants.PRIVATE_KEY_FILE, Constants.PRIVATE_KEY_DATA)); } identityKey = new KeyData(privateKeyString); } if (identityKey != null && StringUtilities.isNotEmpty(privateKeyPassphrase)) { identityKey.setPassPhrase(privateKeyPassphrase); } return identityKey; }
public KeyData(String privateKeyData, String passPhrase) { this.setPrivateKeyData(privateKeyData); this.setPassPhrase(passPhrase); this.setKeyName(); }
protected KeyFile getKeyFile(String privateKeyFile, String privateKeyPassPhrase) { KeyFile keyFile = null; if (privateKeyFile != null && !privateKeyFile.isEmpty()) { if (privateKeyPassPhrase != null && !privateKeyPassPhrase.isEmpty()) { keyFile = new KeyFile(privateKeyFile, privateKeyPassPhrase); } else { keyFile = new KeyFile(privateKeyFile); } } return keyFile; }
protected void cleanupService(SSHShellInputs sshShellInputs, SSHService service, String sessionId) { service.close(); service.removeFromCache(sshShellInputs.getSshGlobalSessionObject(), sessionId); }
public KeyFile(String keyFilePath, String passPhrase) { this.keyFilePath = keyFilePath; this.setPassPhrase(passPhrase); }
public static void setIdentity(JSch jsch, IdentityKey identityKey) throws SSHException { byte[] passPhrase = identityKey.getPassPhrase(); if (identityKey instanceof KeyFile) { try { jsch.addIdentity(((KeyFile) identityKey).getKeyFilePath(), passPhrase); } catch (JSchException e) { throw new SSHException("The keyFilePath is invalid.", e); } } else { try { jsch.addIdentity(((KeyData) identityKey).getKeyName(), ((KeyData) identityKey).getPrivateKeyData(), null, passPhrase); } catch (JSchException e) { throw new SSHException("The " + Constants.PRIVATE_KEY_DATA + " is invalid.", e); } } } }
public static IdentityKey getIdentityKey(String privateKeyFile, String privateKeyString, String privateKeyPassphrase) { IdentityKey identityKey = null; if (StringUtilities.isNotEmpty(privateKeyFile)) { identityKey = new KeyFile(privateKeyFile); } if (StringUtilities.isNotEmpty(privateKeyString)) { if (identityKey != null) { throw new IllegalArgumentException(String.format("%s and %s inputs are mutually exclusive. They can't be both set at the same time.", Constants.PRIVATE_KEY_FILE, Constants.PRIVATE_KEY_DATA)); } identityKey = new KeyData(privateKeyString); } if (identityKey != null && StringUtilities.isNotEmpty(privateKeyPassphrase)) { identityKey.setPassPhrase(privateKeyPassphrase); } return identityKey; }
public KeyData(String privateKeyData, String passPhrase) { this.setPrivateKeyData(privateKeyData); this.setPassPhrase(passPhrase); this.setKeyName(); }
protected KeyFile getKeyFile(String privateKeyFile, String privateKeyPassPhrase) { KeyFile keyFile = null; if (privateKeyFile != null && !privateKeyFile.isEmpty()) { if (privateKeyPassPhrase != null && !privateKeyPassPhrase.isEmpty()) { keyFile = new KeyFile(privateKeyFile, privateKeyPassPhrase); } else { keyFile = new KeyFile(privateKeyFile); } } return keyFile; }
protected void cleanupService(SSHShellInputs sshShellInputs, SSHService service, String sessionId) { service.close(); service.removeFromCache(sshShellInputs.getSshGlobalSessionObject(), sessionId); }
public ProxyConnectionDetails(String proxyHost, int proxyPort, String proxyUsername, String proxyPassword) { this(proxyHost, proxyPort); this.setProxyUsername(proxyUsername); this.setProxyPassword(proxyPassword); }
public KeyData(String privateKeyData) { this.setPrivateKeyData(privateKeyData); this.passPhrase = null; this.setKeyName(); }
public ProxyConnectionDetails(String proxyHost, int proxyPort) { this.setProxyHost(proxyHost); this.setProxyPort(proxyPort); }
public KeyFile(String keyFilePath, String passPhrase) { this.keyFilePath = keyFilePath; this.setPassPhrase(passPhrase); }
protected KeyFile getKeyFile(String privateKeyFile, String privateKeyPassPhrase) { KeyFile keyFile = null; if (privateKeyFile != null && !privateKeyFile.isEmpty()) { if (privateKeyPassPhrase != null && !privateKeyPassPhrase.isEmpty()) { keyFile = new KeyFile(privateKeyFile, privateKeyPassPhrase); } else { keyFile = new KeyFile(privateKeyFile); } } return keyFile; }
protected void cleanupService(SSHShellInputs sshShellInputs, SSHService service, String sessionId) { service.close(); service.removeFromCache(sshShellInputs.getSshGlobalSessionObject(), sessionId); }