You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2011/09/20 00:48:52 UTC

svn commit: r1172873 - in /camel/branches/camel-2.8.x: ./ components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/ components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/

Author: dkulp
Date: Mon Sep 19 22:48:52 2011
New Revision: 1172873

URL: http://svn.apache.org/viewvc?rev=1172873&view=rev
Log:
Merged revisions 1161654 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1161654 | janstey | 2011-08-25 13:28:04 -0400 (Thu, 25 Aug 2011) | 1 line
  
  CAMEL-4382 - add support to set the cipher used for SFTP
........

Added:
    camel/branches/camel-2.8.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetCipherTest.java
      - copied unchanged from r1161654, camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSetCipherTest.java
Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
    camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java?rev=1172873&r1=1172872&r2=1172873&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java (original)
+++ camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java Mon Sep 19 22:48:52 2011
@@ -31,6 +31,9 @@ public class SftpConfiguration extends R
     private int serverAliveInterval;
     private int serverAliveCountMax = 1;
     private String chmod;
+    // comma separated list of ciphers. 
+    // null means default jsch list will be used
+    private String ciphers; 
 
     public SftpConfiguration() {
         setProtocol("sftp");
@@ -101,4 +104,12 @@ public class SftpConfiguration extends R
         return chmod;
     }
 
+    public void setCiphers(String ciphers) {
+        this.ciphers = ciphers;
+    }
+
+    public String getCiphers() {
+        return ciphers;
+    }
+
 }

Modified: camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1172873&r1=1172872&r2=1172873&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java (original)
+++ camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Mon Sep 19 22:48:52 2011
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Vector;
 
@@ -137,6 +138,16 @@ public class SftpOperations implements R
 
         SftpConfiguration sftpConfig = (SftpConfiguration) configuration;
 
+        if (isNotEmpty(sftpConfig.getCiphers())) {
+            LOG.debug("Using ciphers: " + sftpConfig.getCiphers());
+            Hashtable<String,String> ciphers = new Hashtable<String, String>();
+            
+            ciphers.put("cipher.s2c", sftpConfig.getCiphers());
+            ciphers.put("cipher.c2s", sftpConfig.getCiphers());
+
+            JSch.setConfig(ciphers);
+        }
+        
         if (isNotEmpty(sftpConfig.getPrivateKeyFile())) {
             LOG.debug("Using private keyfile: " + sftpConfig.getPrivateKeyFile());
             if (isNotEmpty(sftpConfig.getPrivateKeyFilePassphrase())) {
@@ -160,7 +171,7 @@ public class SftpOperations implements R
         
         session.setServerAliveInterval(sftpConfig.getServerAliveInterval());
         session.setServerAliveCountMax(sftpConfig.getServerAliveCountMax());
-        
+
         // set user information
         session.setUserInfo(new UserInfo() {
             public String getPassphrase() {