Skip to content

Commit 7be2b77

Browse files
authored
Merge pull request #6629 from tevans78/revertPKCS
Revert PR #6611 and PR # 5241 - Issue5019-Java11DefaultToPKCS12
2 parents ef06c8b + 19dc4fc commit 7be2b77

File tree

70 files changed

+163
-1039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+163
-1039
lines changed

dev/com.ibm.ws.config_fat/fat/src/test/server/config/FATSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
VariableMergeTests.class,
2727
MetatypeProviderTest.class,
2828
WSConfigurationHelperTest.class,
29-
//SchemaGeneratorMBeanTest.class,
29+
SchemaGeneratorMBeanTest.class,
3030
FeaturelistGeneratorMBeanTest.class,
3131
ServerXMLConfigurationMBeanTest.class,
3232
DropinsTest.class,

dev/com.ibm.ws.config_fat/fat/src/test/server/config/SchemaGeneratorMBeanTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static void setUp() throws Exception {
9191
server.waitForStringInLog("CWWKO0219I.*ssl"));
9292

9393
// Set up the trust store
94-
System.setProperty("javax.net.ssl.trustStore", outputDir + "/resources/security/key.p12");
94+
System.setProperty("javax.net.ssl.trustStore", outputDir + "/resources/security/key.jks");
9595
System.setProperty("javax.net.ssl.trustStorePassword", "Liberty");
9696

9797
Map<String, Object> environment = new HashMap<String, Object>();

dev/com.ibm.ws.crypto.certificateutil/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $ keytool -genkey -keystore myKS -storepass WebAS0 -keypass WebAS0 -validity 365
1010
# To view the contents of the created keystore:
1111
$ keytool -list -v -keystore myKS -storepass WebAS0
1212

13-
Keystore type: pkcs12
13+
Keystore type: jks
1414
Keystore provider: IBMJCE
1515

1616
Your keystore contains 1 entry

dev/com.ibm.ws.crypto.certificateutil/src/com/ibm/ws/crypto/certificateutil/DefaultSSLCertificateCreator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface DefaultSSLCertificateCreator {
3939
static final int DEFAULT_SIZE = 2048;
4040
static final String KEYALG = KEYALG_RSA_TYPE;
4141
static final String SIGALG = "SHA256withRSA";
42-
static final String DEFAULT_KEYSTORE_TYPE = "PKCS12";
42+
static final String DEFAULT_KEYSTORE_TYPE = "JKS";
4343

4444
/**
4545
* These constants are not intended to be specified by the caller,
@@ -86,7 +86,7 @@ public interface DefaultSSLCertificateCreator {
8686
/**
8787
* Creates a default SSL certificate.
8888
*
89-
* @param filePath The valid, complete path on the file system of the keystore to create. e.g. /tmp/key.p12
89+
* @param filePath The valid, complete path on the file system of the keystore to create. e.g. /tmp/key.jks
9090
* @param password Minimum 6 characters
9191
* @param validity Minimum 365 days (?)
9292
* @param subjectDN The subjectDN. Use {@link DefaultSubjectDN} to construct the default value.

dev/com.ibm.ws.crypto.certificateutil/src/com/ibm/ws/crypto/certificateutil/keytool/KeytoolCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class KeytoolCommand {
4545
* @param ksType
4646
*/
4747
KeytoolCommand(String filePath, String password, int validity, String subjectDN, int keySize, String keyType, String sigAlg, String ksType) {
48-
4948
cmd = new ArrayList<String>();
5049
cmd.add(getAbsoluteKeytoolPath());
5150
cmd.add("-genkey");

dev/com.ibm.ws.crypto.certificateutil/src/com/ibm/ws/crypto/certificateutil/keytool/KeytoolSSLCertificateCreator.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,11 @@ public class KeytoolSSLCertificateCreator implements DefaultSSLCertificateCreato
2828
@Override
2929
public File createDefaultSSLCertificate(String filePath, String password, int validity, String subjectDN, int keySize, String sigAlg) throws CertificateException {
3030

31-
String setKeyStoreType = null;
32-
KeytoolCommand keytoolCmd = null;
33-
3431
validateParameters(filePath, password, validity, subjectDN, keySize, sigAlg);
3532

3633
String keyType = getKeyFromSigAlg(sigAlg);
3734

38-
if (filePath.lastIndexOf(".") != -1) {
39-
setKeyStoreType = filePath.substring(filePath.lastIndexOf(".") + 1, filePath.length());
40-
}
41-
42-
if (!setKeyStoreType.equals("p12") && (!setKeyStoreType.equals(DEFAULT_KEYSTORE_TYPE))) {
43-
keytoolCmd = new KeytoolCommand(filePath, password, validity, subjectDN, keySize, keyType, sigAlg, setKeyStoreType);
44-
} else {
45-
keytoolCmd = new KeytoolCommand(filePath, password, validity, subjectDN, keySize, keyType, sigAlg, DEFAULT_KEYSTORE_TYPE);
46-
}
47-
35+
KeytoolCommand keytoolCmd = new KeytoolCommand(filePath, password, validity, subjectDN, keySize, keyType, sigAlg, DEFAULT_KEYSTORE_TYPE);
4836
keytoolCmd.executeCommand();
4937
File f = new File(filePath);
5038
if (f.exists()) {

dev/com.ibm.ws.crypto.certificateutil/test/com/ibm/ws/crypto/certificateutil/keytool/KeytoolCommandTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class KeytoolCommandTest {
4141

4242
@Test
4343
public void getCommand_justArguments() {
44-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
44+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
4545
List<String> cmdArgs = cmd.getCommandArgs();
4646
assertEquals("-genkey", cmdArgs.get(1));
4747
assertEquals("-keystore", cmdArgs.get(2));
@@ -66,7 +66,7 @@ public void getCommand_justArguments() {
6666

6767
@Test
6868
public void getAbsoluteKeytoolPath() {
69-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
69+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
7070
String path = cmd.getAbsoluteKeytoolPath();
7171
assertTrue("keytool path does not start with this JVM's java.home directory",
7272
path.startsWith(System.getProperty("java.home")));
@@ -88,7 +88,7 @@ public void getAbsoluteKeytoolPath() {
8888
*/
8989
@Test
9090
public void test_toString() {
91-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
91+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
9292
assertFalse("The command line contained the password in plain text",
9393
cmd.toString().contains("myPwd"));
9494

@@ -135,7 +135,7 @@ public void test_toString() {
135135
cmdArgs.append(" ");
136136
cmdArgs.append("-storetype");
137137
cmdArgs.append(" ");
138-
cmdArgs.append("PKCS12");
138+
cmdArgs.append("JKS");
139139
assertEquals("The command line was not in the format expected",
140140
cmdArgs.toString(),
141141
cmd.toString());
@@ -152,7 +152,7 @@ public void getProcErrorOutput_readOnceEOF() throws Exception {
152152
will(returnValue(-1));
153153
}
154154
});
155-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
155+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
156156
cmd.getProcErrorOutput(proc);
157157

158158
mock.assertIsSatisfied();
@@ -169,7 +169,7 @@ public void getProcErrorOutput_readOnceEmpty() throws Exception {
169169
will(returnValue(0));
170170
}
171171
});
172-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
172+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
173173
cmd.getProcErrorOutput(proc);
174174

175175
mock.assertIsSatisfied();
@@ -186,7 +186,7 @@ public void getProcErrorOutput_readOnce() throws Exception {
186186
will(returnValue(50));
187187
}
188188
});
189-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
189+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
190190
cmd.getProcErrorOutput(proc);
191191

192192
mock.assertIsSatisfied();
@@ -206,7 +206,7 @@ public void getProcErrorOutput_readOnceFull() throws Exception {
206206
will(returnValue(-1));
207207
}
208208
});
209-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
209+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
210210
cmd.getProcErrorOutput(proc);
211211

212212
mock.assertIsSatisfied();
@@ -226,7 +226,7 @@ public void getProcErrorOutput_readTwice() throws Exception {
226226
will(returnValue(50));
227227
}
228228
});
229-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
229+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
230230
cmd.getProcErrorOutput(proc);
231231

232232
mock.assertIsSatisfied();
@@ -249,7 +249,7 @@ public void getProcErrorOutput_readTwiceFull() throws Exception {
249249
will(returnValue(-1));
250250
}
251251
});
252-
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "PKCS12");
252+
KeytoolCommand cmd = new KeytoolCommand("myLoc", "myPwd", 365, "CN=myName", 2048, "RSA", "SHA256withRSA", "JKS");
253253
cmd.getProcErrorOutput(proc);
254254

255255
mock.assertIsSatisfied();

dev/com.ibm.ws.crypto.certificateutil/test/com/ibm/ws/crypto/certificateutil/keytool/KeytoolSSLCertificateCreatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
public class KeytoolSSLCertificateCreatorTest {
2828
private final KeytoolSSLCertificateCreator creator = new KeytoolSSLCertificateCreator();
29-
private final String location = System.getProperty("user.dir") + "/build/testKS.p12";
29+
private final String location = System.getProperty("user.dir") + "/build/testKS.jks";
3030

3131
/**
3232
* Test method for {@link com.ibm.ws.crypto.certificateutil.keytool.KeytoolSSLCertificateCreator#KeytoolCommand(java.lang.String, int, java.lang.String)}.

dev/com.ibm.ws.jaxrs.2.0.client_fat/fat/src/com/ibm/ws/jaxrs20/client/fat/FATSuite.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.ibm.ws.jaxrs20.client.fat.test.JAXRSClientSSLDefaultTest;
3030
import com.ibm.ws.jaxrs20.client.fat.test.JAXRSClientSSLFiltersTest;
3131
import com.ibm.ws.jaxrs20.client.fat.test.JAXRSClientSSLProxyAuthTest;
32+
import com.ibm.ws.jaxrs20.client.fat.test.JAXRSClientSSLTest;
3233
import com.ibm.ws.jaxrs20.client.fat.test.JAXRSClientSSLTestNoLibertySSLCfg;
3334
import com.ibm.ws.jaxrs20.client.fat.test.JAXRSClientSSLTestNoLibertySSLFeature;
3435
import com.ibm.ws.jaxrs20.client.fat.test.JAXRSClientStandaloneTest;
@@ -50,7 +51,7 @@
5051
HandleResponsesTest.class,
5152
JAXRSClientStandaloneTest.class,
5253
JAXRS20WithClientFeatureEnabledTest.class,
53-
//JAXRSClientSSLTest.class,
54+
JAXRSClientSSLTest.class,
5455
JAXRSClientSSLDefaultTest.class,
5556
JAXRSClientSSLFiltersTest.class,
5657
JAXRSClientSSLTestNoLibertySSLCfg.class,

dev/com.ibm.ws.jaxrs.2.0.client_fat/fat/src/com/ibm/ws/jaxrs20/client/fat/test/JAXRSClientSSLDefaultTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void testClientBasicSSL_InvalidSSLRef() throws Exception {
9696
this.runTestOnServer(target, "testClientBasicSSL_InvalidSSLRef", p, "the SSL configuration reference \"invalidSSLConfig\" is invalid.");
9797
}
9898

99-
//@Test
99+
@Test
100100
public void testClientBasicSSL_CustomizedSSLContext() throws Exception {
101101
Map<String, String> p = new HashMap<String, String>();
102102
p.put("param", "alex");

0 commit comments

Comments
 (0)