You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/01/23 20:29:54 UTC
qpid-jms git commit: Add tests for creation of SSLContext instances
and SSLEngine instance from various key store types.
Repository: qpid-jms
Updated Branches:
refs/heads/master 6b054d760 -> e1a72b7e6
Add tests for creation of SSLContext instances and SSLEngine instance
from various key store types.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/e1a72b7e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/e1a72b7e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/e1a72b7e
Branch: refs/heads/master
Commit: e1a72b7e6ed682b16e9442cfa429159f624ab072
Parents: 6b054d7
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jan 23 14:29:47 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jan 23 14:29:47 2015 -0500
----------------------------------------------------------------------
.../jms/transports/TransportSupportTest.java | 107 ++++++++++++++++---
.../src/test/resources/broker-jceks.keystore | Bin 0 -> 2176 bytes
.../src/test/resources/broker-jceks.truststore | Bin 0 -> 2176 bytes
.../src/test/resources/broker-jks.keystore | Bin 2102 -> 2198 bytes
.../src/test/resources/broker-jks.truststore | Bin 1589 -> 2198 bytes
.../src/test/resources/broker-pkcs12.keystore | Bin 0 -> 2542 bytes
.../src/test/resources/broker-pkcs12.truststore | Bin 0 -> 2542 bytes
.../src/test/resources/client-jceks.keystore | Bin 0 -> 2176 bytes
.../src/test/resources/client-jceks.truststore | Bin 0 -> 2176 bytes
.../src/test/resources/client-jks.keystore | Bin 2097 -> 2198 bytes
.../src/test/resources/client-jks.truststore | Bin 1592 -> 2198 bytes
.../src/test/resources/client-pkcs12.keystore | Bin 0 -> 2542 bytes
.../src/test/resources/client-pkcs12.truststore | Bin 0 -> 2542 bytes
13 files changed, 95 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
index 1f26e32..a40aa97 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
+import java.io.IOException;
import java.util.Arrays;
import java.util.List;
@@ -36,15 +37,49 @@ import org.junit.Test;
public class TransportSupportTest extends QpidJmsTestCase {
public static final String PASSWORD = "password";
- public static final String BROKER_KEYSTORE = "src/test/resources/broker-jks.keystore";
- public static final String BROKER_TRUSTSTORE = "src/test/resources/broker-jks.truststore";
- public static final String CLINET_KEYSTORE = "src/test/resources/client-jks.keystore";
- public static final String CLINET_TRUSTSTORE = "src/test/resources/client-jks.truststore";
- public static final String KEYSTORE_TYPE = "jks";
+
+ public static final String BROKER_JKS_KEYSTORE = "src/test/resources/broker-jks.keystore";
+ public static final String BROKER_JKS_TRUSTSTORE = "src/test/resources/broker-jks.truststore";
+ public static final String CLINET_JKS_KEYSTORE = "src/test/resources/client-jks.keystore";
+ public static final String CLINET_JKS_TRUSTSTORE = "src/test/resources/client-jks.truststore";
+
+ public static final String BROKER_JCEKS_KEYSTORE = "src/test/resources/broker-jceks.keystore";
+ public static final String BROKER_JCEKS_TRUSTSTORE = "src/test/resources/broker-jceks.truststore";
+ public static final String CLINET_JCEKS_KEYSTORE = "src/test/resources/client-jceks.keystore";
+ public static final String CLINET_JCEKS_TRUSTSTORE = "src/test/resources/client-jceks.truststore";
+
+ public static final String BROKER_PKCS12_KEYSTORE = "src/test/resources/broker-pkcs12.keystore";
+ public static final String BROKER_PKCS12_TRUSTSTORE = "src/test/resources/broker-pkcs12.truststore";
+ public static final String CLINET_PKCS12_KEYSTORE = "src/test/resources/client-pkcs12.keystore";
+ public static final String CLINET_PKCS12_TRUSTSTORE = "src/test/resources/client-pkcs12.truststore";
+
+ public static final String KEYSTORE_JKS_TYPE = "jks";
+ public static final String KEYSTORE_JCEKS_TYPE = "jceks";
+ public static final String KEYSTORE_PKCS12_TYPE = "pkcs12";
+
+ @Test
+ public void testCreateSslContextJksStore() throws Exception {
+ TransportSslOptions options = createJksSslOptions();
+
+ SSLContext context = TransportSupport.createSslContext(options);
+ assertNotNull(context);
+
+ assertEquals("TLS", context.getProtocol());
+ }
+
+ @Test
+ public void testCreateSslContextJceksStore() throws Exception {
+ TransportSslOptions options = createJceksSslOptions();
+
+ SSLContext context = TransportSupport.createSslContext(options);
+ assertNotNull(context);
+
+ assertEquals("TLS", context.getProtocol());
+ }
@Test
- public void testCreateSslContext() throws Exception {
- TransportSslOptions options = createSslOptions();
+ public void testCreateSslContextPkcs12Store() throws Exception {
+ TransportSslOptions options = createPkcs12SslOptions();
SSLContext context = TransportSupport.createSslContext(options);
assertNotNull(context);
@@ -52,9 +87,32 @@ public class TransportSupportTest extends QpidJmsTestCase {
assertEquals("TLS", context.getProtocol());
}
+ @Test(expected = IOException.class)
+ public void testCreateSslContextIncorrectStoreType() throws Exception {
+ TransportSslOptions options = createPkcs12SslOptions();
+ options.setStoreType(KEYSTORE_JKS_TYPE);
+ TransportSupport.createSslContext(options);
+ }
+
+ @Test
+ public void testCreateSslEngineFromJksStore() throws Exception {
+ TransportSslOptions options = createJksSslOptions();
+
+ SSLContext context = TransportSupport.createSslContext(options);
+ assertNotNull(context);
+
+ SSLEngine engine = TransportSupport.createSslEngine(context, options);
+ assertNotNull(engine);
+
+ List<String> engineProtocols = Arrays.asList(engine.getEnabledProtocols());
+ List<String> defaultProtocols = Arrays.asList(TransportSslOptions.DEFAULT_ENABLED_PROTOCOLS);
+
+ assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
+ }
+
@Test
- public void testCreateSslEngine() throws Exception {
- TransportSslOptions options = createSslOptions();
+ public void testCreateSslEngineFromJcsksStore() throws Exception {
+ TransportSslOptions options = createJceksSslOptions();
SSLContext context = TransportSupport.createSslContext(options);
assertNotNull(context);
@@ -68,11 +126,36 @@ public class TransportSupportTest extends QpidJmsTestCase {
assertThat(engineProtocols, containsInAnyOrder(defaultProtocols.toArray()));
}
- private TransportSslOptions createSslOptions() {
+ private TransportSslOptions createJksSslOptions() {
+ TransportSslOptions options = new TransportSslOptions();
+
+ options.setKeyStoreLocation(CLINET_JKS_KEYSTORE);
+ options.setTrustStoreLocation(CLINET_JKS_TRUSTSTORE);
+ options.setStoreType(KEYSTORE_JKS_TYPE);
+ options.setKeyStorePassword(PASSWORD);
+ options.setTrustStorePassword(PASSWORD);
+
+ return options;
+ }
+
+ private TransportSslOptions createJceksSslOptions() {
+ TransportSslOptions options = new TransportSslOptions();
+
+ options.setKeyStoreLocation(CLINET_JCEKS_KEYSTORE);
+ options.setTrustStoreLocation(CLINET_JCEKS_TRUSTSTORE);
+ options.setStoreType(KEYSTORE_JCEKS_TYPE);
+ options.setKeyStorePassword(PASSWORD);
+ options.setTrustStorePassword(PASSWORD);
+
+ return options;
+ }
+
+ private TransportSslOptions createPkcs12SslOptions() {
TransportSslOptions options = new TransportSslOptions();
- options.setKeyStoreLocation(CLINET_KEYSTORE);
- options.setTrustStoreLocation(CLINET_TRUSTSTORE);
+ options.setKeyStoreLocation(CLINET_PKCS12_KEYSTORE);
+ options.setTrustStoreLocation(CLINET_PKCS12_TRUSTSTORE);
+ options.setStoreType(KEYSTORE_PKCS12_TYPE);
options.setKeyStorePassword(PASSWORD);
options.setTrustStorePassword(PASSWORD);
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/broker-jceks.keystore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/broker-jceks.keystore b/qpid-jms-client/src/test/resources/broker-jceks.keystore
new file mode 100644
index 0000000..8b34ab5
Binary files /dev/null and b/qpid-jms-client/src/test/resources/broker-jceks.keystore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/broker-jceks.truststore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/broker-jceks.truststore b/qpid-jms-client/src/test/resources/broker-jceks.truststore
new file mode 100644
index 0000000..5f58d80
Binary files /dev/null and b/qpid-jms-client/src/test/resources/broker-jceks.truststore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/broker-jks.keystore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/broker-jks.keystore b/qpid-jms-client/src/test/resources/broker-jks.keystore
index e23f1a9..cd83384 100644
Binary files a/qpid-jms-client/src/test/resources/broker-jks.keystore and b/qpid-jms-client/src/test/resources/broker-jks.keystore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/broker-jks.truststore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/broker-jks.truststore b/qpid-jms-client/src/test/resources/broker-jks.truststore
index b339423..5fb869f 100644
Binary files a/qpid-jms-client/src/test/resources/broker-jks.truststore and b/qpid-jms-client/src/test/resources/broker-jks.truststore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/broker-pkcs12.keystore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/broker-pkcs12.keystore b/qpid-jms-client/src/test/resources/broker-pkcs12.keystore
new file mode 100644
index 0000000..38dfd3d
Binary files /dev/null and b/qpid-jms-client/src/test/resources/broker-pkcs12.keystore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/broker-pkcs12.truststore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/broker-pkcs12.truststore b/qpid-jms-client/src/test/resources/broker-pkcs12.truststore
new file mode 100644
index 0000000..9f0b2ae
Binary files /dev/null and b/qpid-jms-client/src/test/resources/broker-pkcs12.truststore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/client-jceks.keystore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/client-jceks.keystore b/qpid-jms-client/src/test/resources/client-jceks.keystore
new file mode 100644
index 0000000..80e2907
Binary files /dev/null and b/qpid-jms-client/src/test/resources/client-jceks.keystore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/client-jceks.truststore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/client-jceks.truststore b/qpid-jms-client/src/test/resources/client-jceks.truststore
new file mode 100644
index 0000000..016cc16
Binary files /dev/null and b/qpid-jms-client/src/test/resources/client-jceks.truststore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/client-jks.keystore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/client-jks.keystore b/qpid-jms-client/src/test/resources/client-jks.keystore
index e0474af..fda221d 100644
Binary files a/qpid-jms-client/src/test/resources/client-jks.keystore and b/qpid-jms-client/src/test/resources/client-jks.keystore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/client-jks.truststore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/client-jks.truststore b/qpid-jms-client/src/test/resources/client-jks.truststore
index f9ab34f..18647cb 100644
Binary files a/qpid-jms-client/src/test/resources/client-jks.truststore and b/qpid-jms-client/src/test/resources/client-jks.truststore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/client-pkcs12.keystore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/client-pkcs12.keystore b/qpid-jms-client/src/test/resources/client-pkcs12.keystore
new file mode 100644
index 0000000..6333905
Binary files /dev/null and b/qpid-jms-client/src/test/resources/client-pkcs12.keystore differ
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e1a72b7e/qpid-jms-client/src/test/resources/client-pkcs12.truststore
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/resources/client-pkcs12.truststore b/qpid-jms-client/src/test/resources/client-pkcs12.truststore
new file mode 100644
index 0000000..d50c399
Binary files /dev/null and b/qpid-jms-client/src/test/resources/client-pkcs12.truststore differ
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org