48 |
48 |
49 @Test |
49 @Test |
50 public void testAliasCase() throws Exception { |
50 public void testAliasCase() throws Exception { |
51 final String KEYSTORE_OPTIONS = "-storetype JKS -keystore " |
51 final String KEYSTORE_OPTIONS = "-storetype JKS -keystore " |
52 + "test-alias-case.jks -storepass changeit"; |
52 + "test-alias-case.jks -storepass changeit"; |
53 SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair" |
53 SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair -keyalg DSA" |
54 + " -keypass changeit -alias " + ALIAS + " -dname CN=" + ALIAS) |
54 + " -keypass changeit -alias " + ALIAS + " -dname CN=" + ALIAS) |
55 .shouldHaveExitValue(0); |
55 .shouldHaveExitValue(0); |
56 String jarFilename = "test-alias-case.jar"; |
56 String jarFilename = "test-alias-case.jar"; |
57 JarUtils.createJarFile(Paths.get(jarFilename), Paths.get("."), |
57 JarUtils.createJarFile(Paths.get(jarFilename), Paths.get("."), |
58 Files.write(Paths.get("aFile"), new byte[1])); |
58 Files.write(Paths.get("aFile"), new byte[1])); |
86 public void testAliasCaseStoreHash() throws Exception { |
86 public void testAliasCaseStoreHash() throws Exception { |
87 // Create a keystore with a certificate associated with ALIAS + "2" |
87 // Create a keystore with a certificate associated with ALIAS + "2" |
88 // signed by another certificate associated with ALIAS + "1". |
88 // signed by another certificate associated with ALIAS + "1". |
89 final String KEYSTORE_OPTIONS = "-storetype JKS -keystore" |
89 final String KEYSTORE_OPTIONS = "-storetype JKS -keystore" |
90 + " test-alias-storeHash-case.jks -storepass changeit"; |
90 + " test-alias-storeHash-case.jks -storepass changeit"; |
91 SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair" |
91 SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair -keyalg DSA" |
92 + " -keypass changeit -alias " + ALIAS + "1 -dname CN=" + |
92 + " -keypass changeit -alias " + ALIAS + "1 -dname CN=" + |
93 ALIAS + "1").shouldHaveExitValue(0); |
93 ALIAS + "1").shouldHaveExitValue(0); |
94 SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair" |
94 SecurityTools.keytool(KEYSTORE_OPTIONS + " -genkeypair -keyalg DSA" |
95 + " -keypass changeit -alias " + ALIAS + "2 -dname CN=" |
95 + " -keypass changeit -alias " + ALIAS + "2 -dname CN=" |
96 + ALIAS + "2").shouldHaveExitValue(0); |
96 + ALIAS + "2").shouldHaveExitValue(0); |
97 String certReq = SecurityTools.keytool(KEYSTORE_OPTIONS + |
97 String certReq = SecurityTools.keytool(KEYSTORE_OPTIONS + |
98 " -certreq -keypass changeit -alias " + ALIAS + "2") |
98 " -certreq -keypass changeit -alias " + ALIAS + "2") |
99 .shouldHaveExitValue(0).getStdout(); |
99 .shouldHaveExitValue(0).getStdout(); |