diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java index aeb7524455..6217dbdb6e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java @@ -58,13 +58,18 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { @Parameterized.Parameters(name = "storeType={0}") public static Collection getParameters() { - return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}}); + return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}, {"PKCS12"}}); } public CoreClientOverOneWaySSLTest(String storeType) { this.storeType = storeType; - SERVER_SIDE_KEYSTORE = "server-side-keystore." + storeType.toLowerCase(); - CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + storeType.toLowerCase(); + String suffix = storeType.toLowerCase(); + // keytool expects PKCS12 stores to use the extension "p12" + if (storeType.equals("PKCS12")) { + suffix = "p12"; + } + SERVER_SIDE_KEYSTORE = "server-side-keystore." + suffix; + CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + suffix; } public static final SimpleString QUEUE = new SimpleString("QueueOverSSL"); @@ -97,6 +102,19 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { * keytool -genkey -keystore verified-server-side-keystore.jceks -storetype JCEKS -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" * keytool -export -keystore verified-server-side-keystore.jceks -file activemq-jceks.cer -storetype jceks -storepass secureexample * keytool -import -keystore verified-client-side-truststore.jceks -storetype JCEKS -file activemq-jceks.cer -storepass secureexample -keypass secureexample -noprompt + * + * Commands to create the PKCS12 artifacts: + * keytool -genkey -keystore server-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Server, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA + * keytool -export -keystore server-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample + * keytool -import -keystore client-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt + * + * keytool -genkey -keystore other-server-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=Other ActiveMQ Artemis Server, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA + * keytool -export -keystore other-server-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample + * keytool -import -keystore other-client-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt + * + * keytool -genkey -keystore verified-server-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA + * keytool -export -keystore verified-server-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample + * keytool -import -keystore verified-client-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt */ private String storeType; private String SERVER_SIDE_KEYSTORE; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java index 609174e00f..9c814e93b1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java @@ -58,15 +58,20 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase { @Parameterized.Parameters(name = "storeType={0}") public static Collection getParameters() { - return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}}); + return Arrays.asList(new Object[][]{{"JCEKS"}, {"JKS"}, {"PKCS12"}}); } public CoreClientOverTwoWaySSLTest(String storeType) { this.storeType = storeType; - SERVER_SIDE_KEYSTORE = "server-side-keystore." + storeType.toLowerCase(); - SERVER_SIDE_TRUSTSTORE = "server-side-truststore." + storeType.toLowerCase(); - CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + storeType.toLowerCase(); - CLIENT_SIDE_KEYSTORE = "client-side-keystore." + storeType.toLowerCase(); + String suffix = storeType.toLowerCase(); + // keytool expects PKCS12 stores to use the extension "p12" + if (storeType.equals("PKCS12")) { + suffix = "p12"; + } + SERVER_SIDE_KEYSTORE = "server-side-keystore." + suffix; + SERVER_SIDE_TRUSTSTORE = "server-side-truststore." + suffix; + CLIENT_SIDE_TRUSTSTORE = "client-side-truststore." + suffix; + CLIENT_SIDE_KEYSTORE = "client-side-keystore." + suffix; } public static final SimpleString QUEUE = new SimpleString("QueueOverSSL"); @@ -91,6 +96,15 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase { * keytool -genkey -keystore verified-client-side-keystore.jceks -storetype JCEKS -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA * keytool -export -keystore verified-client-side-keystore.jceks -file activemq-jceks.cer -storetype jceks -storepass secureexample * keytool -import -keystore verified-server-side-truststore.jceks -storetype JCEKS -file activemq-jceks.cer -storepass secureexample -keypass secureexample -noprompt + * + * Commands to create the PKCS12 artifacts: + * keytool -genkey -keystore client-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Client, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA + * keytool -export -keystore client-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample + * keytool -import -keystore server-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt + * + * keytool -genkey -keystore verified-client-side-keystore.p12 -storetype PKCS12 -storepass secureexample -keypass secureexample -dname "CN=localhost, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA + * keytool -export -keystore verified-client-side-keystore.p12 -file activemq-p12.cer -storetype PKCS12 -storepass secureexample + * keytool -import -keystore verified-server-side-truststore.p12 -storetype PKCS12 -file activemq-p12.cer -storepass secureexample -keypass secureexample -noprompt */ private String storeType; diff --git a/tests/unit-tests/src/test/resources/client-side-keystore.p12 b/tests/unit-tests/src/test/resources/client-side-keystore.p12 new file mode 100644 index 0000000000..f36af7cbd9 Binary files /dev/null and b/tests/unit-tests/src/test/resources/client-side-keystore.p12 differ diff --git a/tests/unit-tests/src/test/resources/client-side-truststore.p12 b/tests/unit-tests/src/test/resources/client-side-truststore.p12 new file mode 100644 index 0000000000..de15aa4b6a Binary files /dev/null and b/tests/unit-tests/src/test/resources/client-side-truststore.p12 differ diff --git a/tests/unit-tests/src/test/resources/other-client-side-truststore.p12 b/tests/unit-tests/src/test/resources/other-client-side-truststore.p12 new file mode 100644 index 0000000000..4f06c03664 Binary files /dev/null and b/tests/unit-tests/src/test/resources/other-client-side-truststore.p12 differ diff --git a/tests/unit-tests/src/test/resources/other-server-side-keystore.p12 b/tests/unit-tests/src/test/resources/other-server-side-keystore.p12 new file mode 100644 index 0000000000..40384bf2d8 Binary files /dev/null and b/tests/unit-tests/src/test/resources/other-server-side-keystore.p12 differ diff --git a/tests/unit-tests/src/test/resources/server-side-keystore.p12 b/tests/unit-tests/src/test/resources/server-side-keystore.p12 new file mode 100644 index 0000000000..f9f4dabbe7 Binary files /dev/null and b/tests/unit-tests/src/test/resources/server-side-keystore.p12 differ diff --git a/tests/unit-tests/src/test/resources/server-side-truststore.p12 b/tests/unit-tests/src/test/resources/server-side-truststore.p12 new file mode 100644 index 0000000000..f8daaa35e4 Binary files /dev/null and b/tests/unit-tests/src/test/resources/server-side-truststore.p12 differ diff --git a/tests/unit-tests/src/test/resources/verified-client-side-keystore.p12 b/tests/unit-tests/src/test/resources/verified-client-side-keystore.p12 new file mode 100644 index 0000000000..3cee34acc5 Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-client-side-keystore.p12 differ diff --git a/tests/unit-tests/src/test/resources/verified-client-side-truststore.p12 b/tests/unit-tests/src/test/resources/verified-client-side-truststore.p12 new file mode 100644 index 0000000000..d95f854024 Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-client-side-truststore.p12 differ diff --git a/tests/unit-tests/src/test/resources/verified-server-side-keystore.p12 b/tests/unit-tests/src/test/resources/verified-server-side-keystore.p12 new file mode 100644 index 0000000000..fcf3969012 Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-server-side-keystore.p12 differ diff --git a/tests/unit-tests/src/test/resources/verified-server-side-truststore.p12 b/tests/unit-tests/src/test/resources/verified-server-side-truststore.p12 new file mode 100644 index 0000000000..619adb2ba4 Binary files /dev/null and b/tests/unit-tests/src/test/resources/verified-server-side-truststore.p12 differ