Examples of addIdentity()


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

            if (definition.getKnownHostPath() != null) {
                jsch.setKnownHosts(definition.getKnownHostPath());
            }

            if (definition.getPrivateKeyPath() != null) {
                jsch.addIdentity(definition.getPrivateKeyPath(), definition.getPrivateKeyPassphrase());
            }

            return processConnection(jsch, definition, nodeAddress, effectiveCommand);
        } catch (Exception e) {
            LOGGER.debug("Fail to execute command", e);
View Full Code Here

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

        }

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

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

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

        if (sftpConfig.getPrivateKey() != null) {
            LOG.debug("Using private key information from byte array");
View Full Code Here

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

                    passphrase = sftpConfig.getPrivateKeyPassphrase().getBytes("UTF-8");
                } catch (UnsupportedEncodingException e) {
                    throw new JSchException("Cannot transform passphrase to byte[]", e);
                }
            }
            jsch.addIdentity("ID", sftpConfig.getPrivateKey(), null, passphrase);
        }

        if (sftpConfig.getPrivateKeyUri() != null) {
            LOG.debug("Using private key uri : {}", sftpConfig.getPrivateKeyUri());
            byte[] passphrase = null;
View Full Code Here

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

            }
            try {
                InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(endpoint.getCamelContext().getClassResolver(), sftpConfig.getPrivateKeyUri());
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                IOHelper.copyAndCloseInput(is, bos);
                jsch.addIdentity("ID", bos.toByteArray(), null, passphrase);
            } catch (IOException e) {
                throw new JSchException("Cannot read resource: " + sftpConfig.getPrivateKeyUri(), e);
            }
        }
View Full Code Here

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

                JSch.setConfig(ciphers);
            }
            if (ObjectHelper.isNotEmpty(config.getPrivateKeyFile())) {
                LOG.debug("Using private keyfile: {}", config.getPrivateKeyFile());
                String pkfp = config.getPrivateKeyFilePassphrase();
                jsch.addIdentity(config.getPrivateKeyFile(), ObjectHelper.isNotEmpty(pkfp) ? pkfp : null);
            }

            String knownHostsFile = config.getKnownHostsFile();
            jsch.setKnownHosts(ObjectHelper.isEmpty(knownHostsFile) ? DEFAULT_KNOWN_HOSTS : knownHostsFile);
            session = jsch.getSession(config.getUsername(), config.getHost(), config.getPort());
View Full Code Here

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

                }
                if (allowedAgentUse) {
                    attemptAgentUse(jsch);
                }
                if (pemFile != null) {
                    jsch.addIdentity(pemFile.getAbsolutePath(), pemPassword);
                }
                session.setUserInfo(new CfUserInfo(host, username, userPassword, pemFile,
                        pemPassword, passFile));
                session.setDaemonThread(true);
View Full Code Here

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

        }
        String knownHosts = defaultSSHDir + "/known_hosts";
        knownHosts = System.getProperty("ssh.knownhosts", knownHosts);
        jsch.setKnownHosts(knownHosts);
        identityFile = System.getProperty("ssh.identity", identityFile);
        jsch.addIdentity(identityFile, passphrase.getBytes());
        session = jsch.getSession(user, host);
        Properties props = new Properties();
        props.put("compression.s2c", "none");
        props.put("compression.c2s", "none");
        props.put("cipher.s2c", "blowfish-cbc,3des-cbc");
View Full Code Here

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

    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

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

            for (int iterIdentities = 0; iterIdentities < identities.length; iterIdentities++)
            {
                final File privateKeyFile = identities[iterIdentities];
                try
                {
                    jsch.addIdentity(privateKeyFile.getAbsolutePath());
                }
                catch (final JSchException e)
                {
                    throw new FileSystemException("vfs.provider.sftp/load-private-key.error", privateKeyFile, e);
                }
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.