Package com.jcraft.jsch

Examples of com.jcraft.jsch.JSch.addIdentity()


        if(keyPath == null || keyPath.isEmpty())
            keyPath = System.getProperty("user.home") + "/" + GitDeploymentSynchronizerConstants.SSH_KEY_DIRECTORY;

        if(keyPath.endsWith("/"))
            def.addIdentity(keyPath + keyName);
        else
            def.addIdentity(keyPath + "/" + keyName);

        return def;
    }
View Full Code Here


            keyPath = System.getProperty("user.home") + "/" + GitDeploymentSynchronizerConstants.SSH_KEY_DIRECTORY;

        if(keyPath.endsWith("/"))
            def.addIdentity(keyPath + keyName);
        else
            def.addIdentity(keyPath + "/" + keyName);

        return def;
    }
}
View Full Code Here

        if ( privateKey != null && privateKey.exists() )
        {
            fireSessionDebug( "Using private key: " + privateKey );
            try
            {
                sch.addIdentity( privateKey.getAbsolutePath(), authenticationInfo.getPassphrase() );
            }
            catch ( JSchException e )
            {
                throw new AuthenticationException( "Cannot connect. Reason: " + e.getMessage(), e );
            }
View Full Code Here

        SftpConfiguration sftpConfig = (SftpConfiguration) configuration;

        if (isNotEmpty(sftpConfig.getPrivateKeyFile())) {
            LOG.debug("Using private keyfile: " + sftpConfig.getPrivateKeyFile());
            if (isNotEmpty(sftpConfig.getPrivateKeyFilePassphrase())) {
                jsch.addIdentity(sftpConfig.getPrivateKeyFile(), sftpConfig.getPrivateKeyFilePassphrase());
            } else {
                jsch.addIdentity(sftpConfig.getPrivateKeyFile());
            }
        }
View Full Code Here

        if (isNotEmpty(sftpConfig.getPrivateKeyFile())) {
            LOG.debug("Using private keyfile: " + sftpConfig.getPrivateKeyFile());
            if (isNotEmpty(sftpConfig.getPrivateKeyFilePassphrase())) {
                jsch.addIdentity(sftpConfig.getPrivateKeyFile(), sftpConfig.getPrivateKeyFilePassphrase());
            } else {
                jsch.addIdentity(sftpConfig.getPrivateKeyFile());
            }
        }

        if (isNotEmpty(sftpConfig.getKnownHostsFile())) {
            LOG.debug("Using knownhosts file: " + sftpConfig.getKnownHostsFile());
View Full Code Here

    final String identityKey = identityFile.getAbsolutePath();
    JSch jsch = byIdentityFile.get(identityKey);
    if (jsch == null) {
      jsch = new JSch();
      jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository());
      jsch.addIdentity(identityKey);
      byIdentityFile.put(identityKey, jsch);
    }
    return jsch;
  }
View Full Code Here

         session.setPassword(loginCredentials.getPassword());
      } else {
         checkArgument(!loginCredentials.getPrivateKey().contains("Proc-Type: 4,ENCRYPTED"),
               "JschSshClientModule does not support private keys that require a passphrase");
         byte[] privateKey = loginCredentials.getPrivateKey().getBytes();
         jsch.addIdentity(loginCredentials.getUser(), privateKey, null, emptyPassPhrase);
      }
      java.util.Properties config = new java.util.Properties();
      config.put("StrictHostKeyChecking", "no");
      session.setConfig(config);
      if (proxy.isPresent())
View Full Code Here

    final String identityKey = identityFile.getAbsolutePath();
    JSch jsch = byIdentityFile.get(identityKey);
    if (jsch == null) {
      jsch = new JSch();
      jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository());
      jsch.addIdentity(identityKey);
      byIdentityFile.put(identityKey, jsch);
    }
    return jsch;
  }
View Full Code Here

            final JSch jsch = new JSch();
            java.util.Properties config = new java.util.Properties();
            config.put("StrictHostKeyChecking", "no");

            // Add the private key location
            jsch.addIdentity(OpenShiftCloud.get().getPrivateKey()
                    .getAbsolutePath());

            // The user for the SSH connection is the application uuid
            String username = computer.getNode().getUuid();
            LOGGER.info("Connecting via SSH '" + username + "' '" + hostName + "' '" + OpenShiftCloud.get().getPrivateKey()
View Full Code Here

    logger.debug("exec getSession: on " + host + " : " + port + " user "
        + user);

    final JSch jsch = new JSch();

    jsch.addIdentity(keyFile.getAbsolutePath());

    final Session session = jsch.getSession(user, host, port);

    session.setConfig("StrictHostKeyChecking", "no");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.