Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 26894 invoked from network); 21 Mar 2011 02:59:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Mar 2011 02:59:30 -0000 Received: (qmail 96454 invoked by uid 500); 21 Mar 2011 02:59:29 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 96407 invoked by uid 500); 21 Mar 2011 02:59:29 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 96398 invoked by uid 99); 21 Mar 2011 02:59:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Mar 2011 02:59:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Mar 2011 02:59:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6336540111C for ; Mon, 21 Mar 2011 02:59:06 +0000 (UTC) Date: Mon, 21 Mar 2011 02:59:06 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: <1760128473.317.1300676346403.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (NET-326) A KeyManager is required when the protection level is set to 'P' with FTPSClient on active mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/NET-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009009#comment-13009009 ] Sebb commented on NET-326: -------------------------- With the new KeyManagerUtils class, the code becomes: {code} FTPSClient cl = new FTPSClient(); KeyStore ks = KeyManagerUtils.createKeyStore("JKS","/path/to/privatekeystore.jks","storepassword"); KeyManager km = KeyManagerUtils.createClientKeyManager(ks, "privatekeyalias", "keypassword"); cl.setKeyManager(km); // If the FTP server certificate is not trusted by the JVM, add this: X509TrustManager tm = TrustManagerUtils.getAcceptAllTrustManager(); cl.setTrustManager(tm); cl.connect(...); {code} The new class is slightly different from the original solution, as it does not use an explicit SSLContext to initialise the FTPSClient, nor does it use the KeyManagerFactory. This allows it to use the setKeyManager/setTrustManager methods. > A KeyManager is required when the protection level is set to 'P' with FTPSClient on active mode > ----------------------------------------------------------------------------------------------- > > Key: NET-326 > URL: https://issues.apache.org/jira/browse/NET-326 > Project: Commons Net > Issue Type: Bug > Components: FTP > Affects Versions: 2.0 > Environment: Windows XP profesional service pack 2, Java Java 1.6.0_12-b04 > Reporter: Terence Dudouit > Attachments: SSLContextsFactory.java > > > Using a simple FTPS client that list a directory, when execPROT("P") is set and the active mode is on, the following exception is thrown : > javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL cipher suites which are enabled. > at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.checkEnabledSuites(SSLServerSocketImpl.java:303) > at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.accept(SSLServerSocketImpl.java:253) > at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:489) > at org.apache.commons.net.ftp.FTPSClient._openDataConnection_(FTPSClient.java:494) > at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:1950) > at org.apache.commons.net.ftp.FTPClient.listNames(FTPClient.java:1996) > at fr.enovacom.eai.actions.dynamiques.protocole.ftp.FTPGet.testFTPS(FTPGet.java:379) > at fr.enovacom.eai.actions.dynamiques.protocole.ftp.FTPGet.main(FTPGet.java:401) > This doesn't occur on passive mode. > The only way to make it work is to set a keyManager although there is no need for a client authentication. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira