Tabnine Logo
net.schmizz.sshj
Code IndexAdd Tabnine to your IDE (free)

How to use net.schmizz.sshj

Best Java code snippets using net.schmizz.sshj (Showing top 20 results out of 315)

origin: hierynomus/sshj

/**
 * Same as {@link #disconnect()}.
 *
 * @throws IOException
 */
@Override
public void close()
    throws IOException {
  disconnect();
}
origin: hierynomus/sshj

/**
 * Does key re-exchange.
 *
 * @throws TransportException if an error occurs during key exchange
 */
public void rekey()
    throws TransportException {
  doKex();
}
origin: hierynomus/sshj

/** On connection establishment, also initializes the SSH transport via {@link Transport#init} and {@link #doKex()}. */
@Override
protected void onConnect()
    throws IOException {
  super.onConnect();
  trans.init(getRemoteHostname(), getRemotePort(), getInputStream(), getOutputStream());
  doKex();
}
origin: hierynomus/sshj

public SSHClient setupClient(Config config) {
  if (client == null) {
    client = new SSHClient(config);
    client.addHostKeyVerifier(fingerprint);
  }
  return client;
}
origin: hierynomus/sshj

/**
 * Adds a {@link OpenSSHKnownHosts} object created from the specified location as a host key verifier.
 *
 * @param location location for {@code known_hosts} file
 *
 * @throws IOException if there is an error loading from any of these locations
 */
public void loadKnownHosts(File location)
    throws IOException {
  addHostKeyVerifier(new OpenSSHKnownHosts(location, loggerFactory));
}
origin: hierynomus/sshj

private void checkConnected() {
  if (!isConnected()) {
    throw new IllegalStateException("Not connected");
  }
}
origin: hierynomus/sshj

@Override
public Session startSession()
    throws ConnectionException, TransportException {
  checkConnected();
  checkAuthenticated();
  final SessionChannel sess = new SessionChannel(conn, remoteCharset);
  sess.open();
  return sess;
}
origin: hierynomus/sshj

private void checkAuthenticated() {
  if (!isAuthenticated()) {
    throw new IllegalStateException("Not authenticated");
  }
}
origin: hierynomus/sshj

/** @return Instantiated {@link SCPFileTransfer} implementation. */
public SCPFileTransfer newSCPFileTransfer() {
  checkConnected();
  checkAuthenticated();
  return new SCPFileTransfer(this, loggerFactory);
}
origin: hierynomus/sshj

/**
 * Returns a {@link KeyProvider} instance created from a location on the file system where an <em>unencrypted</em>
 * private key file (does not require a passphrase) can be found. Simply calls {@link #loadKeys(String,
 * PasswordFinder)} with the {@link PasswordFinder} argument as {@code null}.
 *
 * @param location the location for the key file
 *
 * @return the key provider ready for use in authentication
 *
 * @throws SSHException if there was no suitable key provider available for the file format; typically because
 *                      BouncyCastle is not in the classpath
 * @throws IOException  if the key file format is not known, if the file could not be read, etc.
 */
public KeyProvider loadKeys(String location)
    throws IOException {
  return loadKeys(location, (PasswordFinder) null);
}
origin: hierynomus/sshj

/** Default constructor. Initializes this object using {@link DefaultConfig}. */
public SSHClient() {
  this(new DefaultConfig());
}
origin: hierynomus/sshj

/** @return whether connected. */
@Override
public boolean isConnected() {
  return super.isConnected() && trans.isRunning();
}
origin: hierynomus/sshj

public void connect(String hostname) throws IOException {
  connect(hostname, defaultPort);
}
origin: hierynomus/sshj

@Override
protected Config getClientConfig(DefaultConfig config) {
  config.setKeyExchangeFactories(Collections.singletonList(clientFactory));
  return config;
}
origin: hierynomus/sshj

@Override
public String getNextServiceName() {
  return nextService.getName();
}
origin: hierynomus/sshj

@Override
public void notifyError(SSHException error) {
  super.notifyError(error);
  authenticated.deliverError(error);
}
origin: hierynomus/sshj

public void connect(InetAddress host) throws IOException {
  connect(host, defaultPort);
}
origin: hierynomus/sshj

@Override
public synchronized void setService(Service service) {
  if (service == null)
    service = nullService;
  log.debug("Setting active service to {}", service.getName());
  this.service = service;
}
origin: hierynomus/sshj

/**
 * Connect to a host via a proxy.
 * @param hostname The host name to connect to.
 * @param proxy The proxy to connect via.
 * @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory}
 *             into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor.
 */
@Deprecated
public void connect(String hostname, Proxy proxy) throws IOException {
  connect(hostname, defaultPort, proxy);
}
origin: hierynomus/sshj

/**
 * Connect to a host via a proxy.
 * @param host The host address to connect to.
 * @param proxy The proxy to connect via.
 * @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory}
 *             into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket#Socket(java.net.Proxy)} constructor.
 */
@Deprecated
public void connect(InetAddress host, Proxy proxy) throws IOException {
  connect(host, defaultPort, proxy);
}
net.schmizz.sshj

Most used classes

  • SSHClient
    Secure SHell client API. Before connection is established, host key verification needs to be account
  • Session
    A session channel provides for execution of a remote Command, Shell or Subsystem. Before this reques
  • Session$Command
    Command API.
  • PromiscuousVerifier
  • IOUtils
  • SessionChannel,
  • SFTPClient,
  • SFTPEngine,
  • SCPFileTransfer,
  • RemoteFile,
  • Buffer$PlainBuffer,
  • Transport,
  • SSHException,
  • FileAttributes$Builder,
  • FileKeyProvider,
  • KeyProviderUtil,
  • DefaultConfig,
  • KeyType,
  • Connection
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now