You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2015/03/13 19:46:47 UTC
cxf git commit: [CXF-6294] - Cannot activate TLSv1.2 cipher suites on
client on Java7 - Adding a test
Repository: cxf
Updated Branches:
refs/heads/master d1c7f1f6b -> 08f376bdf
[CXF-6294] - Cannot activate TLSv1.2 cipher suites on client on Java7
- Adding a test
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/08f376bd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/08f376bd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/08f376bd
Branch: refs/heads/master
Commit: 08f376bdfd744b99132387076f3fc61167a330ec
Parents: d1c7f1f
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Mar 13 18:46:23 2015 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Mar 13 18:46:23 2015 +0000
----------------------------------------------------------------------
.../https/SSLSocketFactoryWrapper.java | 17 ++++-----
.../https/ciphersuites/CipherSuitesTest.java | 25 ++++++++++++-
.../ciphersuites/ciphersuites-client-tlsv12.xml | 37 ++++++++++++++++++++
3 files changed, 70 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/08f376bd/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
index 6f58e4a..4e635f0 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
-
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Handler;
@@ -97,19 +96,21 @@ class SSLSocketFactoryWrapper extends SSLSocketFactory {
private Socket enableCipherSuites(Socket s, Object[] logParams) {
SSLSocket socket = (SSLSocket)s;
- if ((socket != null) && (ciphers != null)) {
- socket.setEnabledCipherSuites(ciphers);
+ if (socket == null) {
+ LogUtils.log(LOG, Level.SEVERE,
+ "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
+ logParams);
+ return socket;
}
- if ((socket != null) && (protocol != null)) {
+
+ if (protocol != null) {
String p[] = findProtocols(protocol, socket.getSupportedProtocols());
if (p != null) {
socket.setEnabledProtocols(p);
}
}
- if (socket == null) {
- LogUtils.log(LOG, Level.SEVERE,
- "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
- logParams);
+ if (ciphers != null) {
+ socket.setEnabledCipherSuites(ciphers);
}
return socket;
http://git-wip-us.apache.org/repos/asf/cxf/blob/08f376bd/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
index 3a93002..a1002e3 100644
--- a/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
+++ b/systests/transports/src/test/java/org/apache/cxf/systest/https/ciphersuites/CipherSuitesTest.java
@@ -414,5 +414,28 @@ public class CipherSuitesTest extends AbstractBusClientServerTestBase {
((java.io.Closeable)port).close();
bus.shutdown(true);
}
-
+
+ // Both client + server include AES, client enables a TLS v1.2 CipherSuite
+ @org.junit.Test
+ public void testAESIncludedTLSv12() throws Exception {
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = CipherSuitesTest.class.getResource("ciphersuites-client-tlsv12.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ URL url = SOAPService.WSDL_LOCATION;
+ SOAPService service = new SOAPService(url, SOAPService.SERVICE);
+ assertNotNull("Service is null", service);
+ final Greeter port = service.getHttpsPort();
+ assertNotNull("Port is null", port);
+
+ updateAddressPort(port, PORT);
+
+ assertEquals(port.greetMe("Kitty"), "Hello Kitty");
+
+ ((java.io.Closeable)port).close();
+ bus.shutdown(true);
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/08f376bd/systests/transports/src/test/resources/org/apache/cxf/systest/https/ciphersuites/ciphersuites-client-tlsv12.xml
----------------------------------------------------------------------
diff --git a/systests/transports/src/test/resources/org/apache/cxf/systest/https/ciphersuites/ciphersuites-client-tlsv12.xml b/systests/transports/src/test/resources/org/apache/cxf/systest/https/ciphersuites/ciphersuites-client-tlsv12.xml
new file mode 100644
index 0000000..b0f39ce
--- /dev/null
+++ b/systests/transports/src/test/resources/org/apache/cxf/systest/https/ciphersuites/ciphersuites-client-tlsv12.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/policy http://cxf.apache.org/schemas/poli
cy.xsd">
+
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
+ <http:conduit name="https://localhost:.*">
+ <http:tlsClientParameters disableCNCheck="true" secureSocketProtocol="TLSv1.2">
+ <sec:trustManagers>
+ <sec:keyStore type="jks" password="password" resource="keys/Truststore.jks"/>
+ </sec:trustManagers>
+ <sec:cipherSuites>
+ <sec:cipherSuite>TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256</sec:cipherSuite>
+ </sec:cipherSuites>
+ </http:tlsClientParameters>
+ </http:conduit>
+</beans>