You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Hadrian Zbarcea (JIRA)" <ji...@apache.org> on 2012/05/05 23:21:49 UTC

[jira] [Commented] (CAMEL-5242) camel-jsch (a.k.a camel-scp) component doesn't support public-private key based authentication

    [ https://issues.apache.org/jira/browse/CAMEL-5242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269063#comment-13269063 ] 

Hadrian Zbarcea commented on CAMEL-5242:
----------------------------------------

Mohammad, your proposed fix is good. I need to finish a test for it. I noticed today that the same feature is not tested in sftp either. I have some time tomorrow afternoon to work on the test.
                
> camel-jsch (a.k.a camel-scp) component doesn't support public-private key based authentication
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-5242
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5242
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jsch
>    Affects Versions: Future
>            Reporter: Mohammad Wrk
>            Assignee: Hadrian Zbarcea
>
> Camel uses JSCH (http://www.jcraft.com/jsch/) library to support both SCP and SFTP. This library supports public-private key based authentication using com.jcraft.jsch.JSch.addIdentity method. However looks like Camel only supports this feature for SFTP component (http://camel.apache.org/ftp2.html) and there is no support for SCP (http://camel.apache.org/jsch.html)!
> Taking into account the fact that org.apache.camel.component.jsch.ScpConfiguration (version 2.9.2) already has two attributes (privateKeyFile and privateKeyFilePassphrase) for collecting the related data, I think the change for this improvement should be something like :
>  org.apache.camel.component.jsch.ScpOperations.createSession(ScpConfiguration config) {
>         ObjectHelper.notNull(config, "ScpConfiguration");
>         try {
>             final JSch jsch = new JSch();
>             // get from configuration
>             if (isNotEmpty(config.getCiphers())) {
>                 LOG.debug("Using ciphers: {}", config.getCiphers());
>                 Hashtable<String, String> ciphers = new Hashtable<String, String>();
>                 ciphers.put("cipher.s2c", config.getCiphers());
>                 ciphers.put("cipher.c2s", config.getCiphers());
>                 JSch.setConfig(ciphers);
>             }
>             //New code to handle public-private key based authentication
>             if (isNotEmpty(config.getPrivateKeyFile())) {
>                LOG.debug("Using private keyfile: {}", config.getPrivateKeyFile());
>                if (isNotEmpty(config.getPrivateKeyFilePassphrase())) {
>                    jsch.addIdentity(config.getPrivateKeyFile(), config.getPrivateKeyFilePassphrase());
>                } else {
>                    jsch.addIdentity(config.getPrivateKeyFile());
>                }
>            }
>         ...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira