public SshClient doCreateClient(SshConfiguration configuration) { // Much of JSch configuration is global :( configureAlgorithms(configuration); return new JschSshClient(configuration); }
public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException { return new RemoteSocket(session, host, port); }
public String getFingerprint() { return getFingerPrint(hash, key); } })) {
public SshKeyPair toKeyPair() throws SshException { if (isEncrypted()) { throw new SshException(SshException.PASSPHRASE_REQUIRED, "Key is currently encrypyted. Please decrypt before changing passphrase."); } System.out.println("KEYBITS: " + kpair.getPublicKeyBlob().length); return new SshKeyPair(new JschPublicKey(kpair, kpair.getPublicKeyBlob().length), new JschPrivateKey(kpair)); }
public SshPrivateKeyFile createPrivateKeyFromStream(InputStream in) throws SshException { try { File file = toTemporaryFile(in, ""); KeyPair kpair = KeyPair.load(jsch, file.getAbsolutePath()); return new JschPrivateKeyFile(kpair); } catch (JSchException e) { throw new SshException(e); } catch (IOException ioe) { throw new SshException(SshException.IO_ERROR, ioe); } }
public boolean isAuthenticated() { return isConnected() && authenticated; }
RemoteSocket(Session session, InetAddress host, int port) throws UnknownHostException, IOException { super(); this.session = session; this.connect(new InetSocketAddress(host, port)); }
public OutputStream put(final String path, final int permissions) throws SshException { return put(path, permissions, 0); }
public boolean isConnected() { return channel != null && !isClosed(); } }
public SshHostKeyManager createHostKeyManager(SshConfiguration configuration) throws SshException { return new JschHostKeyManager(configuration); }
public SshIdentityManager createIdentityManager(SshConfiguration configuration) { return new JschIdentityManager(configuration); }
public SocketFactory createTunneledSocketFactory() throws SshException { return new RemoteSocketFactory(session); }
public SshSCPClient createSCPClient() throws SshException { return new JschSCPClient(this); }
public void requestPseudoTerminalChange(int width, int height, int pixw, int pixh) throws SshException { try { ((ChannelShell) getChannel()).setPtySize(width, height, pixw, pixh); } catch (Exception e) { throw new SshException(SshException.GENERAL, e); } }
public Socket createSocket(String host, int port) throws IOException, UnknownHostException { return new RemoteSocket(session, host, port); }
public int getRemoteProtocolVersion() { if (!isConnected()) { throw new IllegalStateException("Not connected"); } // Jsch only supports SSH2 return SshConfiguration.SSH2_ONLY; }
RemoteSocket(Session session, String host, int port) throws UnknownHostException, IOException { super(); this.session = session; this.connect(new InetSocketAddress(InetAddress.getByName(host), port)); }
public Socket createSocket(InetAddress host, int port) throws IOException { return new RemoteSocket(session, host, port); }
public Socket createSocket() throws IOException { return new RemoteSocket(session); }
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException { return new RemoteSocket(session, address, port); }