You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2017/07/05 09:42:55 UTC

[2/4] tomee git commit: Revert "[WIP] [Send-upsteam-to-OSS] Use fixed keystores instead of an Ant task to speed up build and make…"

Revert "[WIP] [Send-upsteam-to-OSS] Use fixed keystores instead of an Ant task to speed up build and make…"


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/ab186d62
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/ab186d62
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/ab186d62

Branch: refs/heads/tomee-1.7.x
Commit: ab186d629cccfbbcf885f1e4969a252e7a2483f1
Parents: 39c8c87
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Fri Jun 30 10:18:20 2017 +0100
Committer: GitHub <no...@github.com>
Committed: Fri Jun 30 10:18:20 2017 +0100

----------------------------------------------------------------------
 .../webservice-ws-security/create-keystores.xml | 198 +++++++++++++++++++
 examples/webservice-ws-security/pom.xml         |  19 ++
 .../src/main/resources/META-INF/clientStore.jks | Bin 2830 -> 0 bytes
 .../src/main/resources/META-INF/serverStore.jks | Bin 2830 -> 0 bytes
 4 files changed, 217 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ab186d62/examples/webservice-ws-security/create-keystores.xml
----------------------------------------------------------------------
diff --git a/examples/webservice-ws-security/create-keystores.xml b/examples/webservice-ws-security/create-keystores.xml
new file mode 100644
index 0000000..cfd0cbf
--- /dev/null
+++ b/examples/webservice-ws-security/create-keystores.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0"?>
+<!--
+
+    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.
+
+-->
+
+<project default="run" name="create keystores et al">
+
+  <!-- first create our properties -->
+  <condition property="is.ibm.jdk">
+    <available classname="com.ibm.crypto.tools.KeyTool"/>
+  </condition>
+  <condition property="is.sun.jdk">
+    <available classname="sun.security.tools.KeyTool"/>
+  </condition>
+  <property name="server.alias" value="serveralias"/>
+  <property name="server.keypass" value="serverPassword"/>
+  <property name="server.keystore" value="${basedir}/target/classes/META-INF/serverStore.jks"/>
+  <property name="server.storepass" value="keystorePass"/>
+  <property name="server.dname" value="'cn=serveralias'"/>
+  <property name="server.file" value="${basedir}/target/classes/META-INF/serverKey.rsa"/>
+
+  <property name="client.alias" value="clientalias"/>
+  <property name="client.keypass" value="clientPassword"/>
+  <property name="client.keystore" value="${basedir}/target/test-classes/META-INF/clientStore.jks"/>
+  <property name="client.storepass" value="keystorePass"/>
+  <property name="client.dname" value="'cn=clientalias'"/>
+  <property name="client.file" value="${basedir}/target/test-classes/META-INF/clientKey.rsa"/>
+
+  <property name="keyalg" value="RSA"/>
+
+  <!-- now create our JDK specific targets -->
+  <target name="do.ibm.jdk" if="is.ibm.jdk">
+    <echo message="*** Running on an IBM JDK ***"/>
+    <echo message="generate server keys"/>
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-genkey"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-keypass ${server.keypass}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+      <arg line="-dname ${server.dname}"/>
+      <arg line="-keyalg ${keyalg}"/>
+    </java>
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-selfcert"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+      <arg line="-keypass ${server.keypass}"/>
+    </java>
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-export"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-file ${server.file}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+    </java>
+
+    <echo message="generate client keys"/>
+
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-genkey"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-keypass ${client.keypass}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+      <arg line="-dname ${client.dname}"/>
+      <arg line="-keyalg ${keyalg}"/>
+    </java>
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-selfcert"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+      <arg line="-keypass ${client.keypass}"/>
+    </java>
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-export"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-file ${client.file}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+    </java>
+
+    <echo message="import client/server public keys in client/server keystores"/>
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-import"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-file ${server.file}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+      <arg line="-noprompt"/>
+    </java>
+    <java classname="com.ibm.crypto.tools.KeyTool" fork="true">
+      <arg line="-import"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-file ${client.file}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+      <arg line="-noprompt"/>
+    </java>
+  </target>
+
+  <target name="do.sun.jdk" if="is.sun.jdk">
+    <echo message="*** Running on a Sun JDK ***"/>
+    <echo message="generate server keys"/>
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-genkey"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-keypass ${server.keypass}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+      <arg line="-dname ${server.dname}"/>
+      <arg line="-keyalg ${keyalg}"/>
+    </java>
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-selfcert"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+      <arg line="-keypass ${server.keypass}"/>
+    </java>
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-export"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-file ${server.file}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+    </java>
+
+    <echo message="generate client keys"/>
+
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-genkey"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-keypass ${client.keypass}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+      <arg line="-dname ${client.dname}"/>
+      <arg line="-keyalg ${keyalg}"/>
+    </java>
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-selfcert"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+      <arg line="-keypass ${client.keypass}"/>
+    </java>
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-export"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-file ${client.file}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+    </java>
+
+    <echo message="import client/server public keys in client/server keystores"/>
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-import"/>
+      <arg line="-alias ${server.alias}"/>
+      <arg line="-file ${server.file}"/>
+      <arg line="-keystore ${client.keystore}"/>
+      <arg line="-storepass ${client.storepass}"/>
+      <arg line="-noprompt"/>
+    </java>
+    <java classname="sun.security.tools.KeyTool" fork="true">
+      <arg line="-import"/>
+      <arg line="-alias ${client.alias}"/>
+      <arg line="-file ${client.file}"/>
+      <arg line="-keystore ${server.keystore}"/>
+      <arg line="-storepass ${server.storepass}"/>
+      <arg line="-noprompt"/>
+    </java>
+  </target>
+
+  <!-- run everything from our main target -->
+  <!-- the other targets will only be run when their properties are true -->
+  <target name="run" depends="do.sun.jdk, do.ibm.jdk">
+    <echo message="Running JDK specific keystore creation target"/>
+  </target>
+
+</project>
+

http://git-wip-us.apache.org/repos/asf/tomee/blob/ab186d62/examples/webservice-ws-security/pom.xml
----------------------------------------------------------------------
diff --git a/examples/webservice-ws-security/pom.xml b/examples/webservice-ws-security/pom.xml
index 5c0e9b0..85956d7 100644
--- a/examples/webservice-ws-security/pom.xml
+++ b/examples/webservice-ws-security/pom.xml
@@ -112,6 +112,25 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>generate-keys</id>
+            <phase>process-test-resources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target name="generate keys">
+                <ant antfile="create-keystores.xml" target="run" />
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <!--

http://git-wip-us.apache.org/repos/asf/tomee/blob/ab186d62/examples/webservice-ws-security/src/main/resources/META-INF/clientStore.jks
----------------------------------------------------------------------
diff --git a/examples/webservice-ws-security/src/main/resources/META-INF/clientStore.jks b/examples/webservice-ws-security/src/main/resources/META-INF/clientStore.jks
deleted file mode 100644
index 7e3c1ce..0000000
Binary files a/examples/webservice-ws-security/src/main/resources/META-INF/clientStore.jks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tomee/blob/ab186d62/examples/webservice-ws-security/src/main/resources/META-INF/serverStore.jks
----------------------------------------------------------------------
diff --git a/examples/webservice-ws-security/src/main/resources/META-INF/serverStore.jks b/examples/webservice-ws-security/src/main/resources/META-INF/serverStore.jks
deleted file mode 100644
index fe6b68f..0000000
Binary files a/examples/webservice-ws-security/src/main/resources/META-INF/serverStore.jks and /dev/null differ