author | weijun |
Fri, 15 Nov 2019 09:06:58 +0800 | |
changeset 59104 | 046e4024e55a |
parent 48333 | f47c18852172 |
permissions | -rw-r--r-- |
48333
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
1 |
/* |
59104 | 2 |
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
48333
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
4 |
* |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
8 |
* |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
13 |
* accompanied this code). |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
14 |
* |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
18 |
* |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
21 |
* questions. |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
22 |
*/ |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
23 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
24 |
/* |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
25 |
* @test |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
26 |
* @bug 8192988 |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
27 |
* @summary keytool should support -storepasswd for pkcs12 keystores |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
28 |
* @library /test/lib |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
29 |
* @build jdk.test.lib.SecurityTools |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
30 |
* jdk.test.lib.Utils |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
31 |
* jdk.test.lib.Asserts |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
32 |
* jdk.test.lib.JDKToolFinder |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
33 |
* jdk.test.lib.JDKToolLauncher |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
34 |
* jdk.test.lib.Platform |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
35 |
* jdk.test.lib.process.* |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
36 |
* @run main PKCS12Passwd |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
37 |
*/ |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
38 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
39 |
import jdk.test.lib.Asserts; |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
40 |
import jdk.test.lib.SecurityTools; |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
41 |
import jdk.test.lib.process.OutputAnalyzer; |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
42 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
43 |
import java.io.File; |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
44 |
import java.security.KeyStore; |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
45 |
import java.util.Collections; |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
46 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
47 |
public class PKCS12Passwd { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
48 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
49 |
public static void main(String[] args) throws Exception { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
50 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
51 |
// A PrivateKeyEntry |
59104 | 52 |
kt("-genkeypair -alias a -dname CN=A -keyalg DSA") |
48333
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
53 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
54 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
55 |
// A TrustedCertificateEntry (genkeypair, export, delete, import) |
59104 | 56 |
kt("-genkeypair -alias b -dname CN=B -keyalg DSA") |
48333
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
57 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
58 |
kt("-exportcert -alias b -file b.cert") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
59 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
60 |
kt("-delete -alias b") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
61 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
62 |
kt("-list -alias b") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
63 |
.shouldHaveExitValue(1); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
64 |
kt("-importcert -alias b -file b.cert -noprompt") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
65 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
66 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
67 |
// A SecretKeyEntry |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
68 |
kt("-genseckey -keyalg AES -keysize 256 -alias c") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
69 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
70 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
71 |
// Change password |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
72 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
73 |
// 1. Using -importkeystore |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
74 |
ktFull("-importkeystore -srckeystore ks -destkeystore ks2 " |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
75 |
+ "-srcstoretype pkcs12 -deststoretype pkcs12 " |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
76 |
+ "-srcstorepass changeit -deststorepass newpass") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
77 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
78 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
79 |
check("ks2", "newpass", "newpass"); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
80 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
81 |
// 2. Using -storepasswd |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
82 |
kt("-storepasswd -new newpass") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
83 |
.shouldHaveExitValue(0) |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
84 |
.shouldNotContain("Ignoring user-specified"); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
85 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
86 |
check("ks", "newpass", "newpass"); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
87 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
88 |
// Other facts. Not necessarily the correct thing. |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
89 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
90 |
// A PKCS12 keystore can be loaded as a JKS, and it follows JKS rules |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
91 |
// which means the storepass and keypass can be changed separately! |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
92 |
|
59104 | 93 |
ktFull("-genkeypair -alias a -dname CN=A -storetype pkcs12 -keyalg DSA " |
48333
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
94 |
+ "-storepass changeit -keypass changeit -keystore p12") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
95 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
96 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
97 |
// Only storepass is changed |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
98 |
ktFull("-storepasswd -storepass changeit -new newpass " |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
99 |
+ "-keystore p12 -storetype jks") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
100 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
101 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
102 |
check("p12", "newpass", "changeit"); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
103 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
104 |
// Only keypass is changed |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
105 |
ktFull("-keypasswd -storepass newpass -keypass changeit -new newpass " |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
106 |
+ "-keystore p12 -storetype jks -alias a") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
107 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
108 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
109 |
check("p12", "newpass", "newpass"); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
110 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
111 |
// Conversely, a JKS keystore can be laoded as a PKCS12, and it follows |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
112 |
// PKCS12 rules that both passwords are changed at the same time and |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
113 |
// some commands are rejected. |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
114 |
|
59104 | 115 |
ktFull("-genkeypair -alias a -dname CN=A -storetype jks -keyalg DSA " |
48333
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
116 |
+ "-storepass changeit -keypass changeit -keystore jks") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
117 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
118 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
119 |
// Both storepass and keypass changed. |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
120 |
ktFull("-storepasswd -storepass changeit -new newpass " |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
121 |
+ "-keystore jks -storetype pkcs12") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
122 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
123 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
124 |
check("jks", "newpass", "newpass"); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
125 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
126 |
// -keypasswd is not available for pkcs12 |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
127 |
ktFull("-keypasswd -storepass newpass -keypass newpass -new newerpass " |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
128 |
+ "-keystore jks -storetype pkcs12 -alias a") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
129 |
.shouldHaveExitValue(1); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
130 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
131 |
// but available for JKS |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
132 |
ktFull("-keypasswd -storepass newpass -keypass newpass -new newerpass " |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
133 |
+ "-keystore jks -alias a") |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
134 |
.shouldHaveExitValue(0); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
135 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
136 |
check("jks", "newpass", "newerpass"); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
137 |
} |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
138 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
139 |
// Makes sure we can load entries in a keystore |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
140 |
static void check(String file, String storePass, String keyPass) |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
141 |
throws Exception { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
142 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
143 |
KeyStore ks = KeyStore.getInstance( |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
144 |
new File(file), storePass.toCharArray()); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
145 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
146 |
for (String a : Collections.list(ks.aliases())) { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
147 |
if (ks.isCertificateEntry(a)) { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
148 |
ks.getCertificate(a); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
149 |
} else { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
150 |
ks.getEntry(a, |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
151 |
new KeyStore.PasswordProtection(keyPass.toCharArray())); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
152 |
} |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
153 |
} |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
154 |
} |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
155 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
156 |
static OutputAnalyzer kt(String arg) throws Exception { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
157 |
return ktFull("-keystore ks -storepass changeit " + arg); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
158 |
} |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
159 |
|
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
160 |
static OutputAnalyzer ktFull(String arg) throws Exception { |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
161 |
return SecurityTools.keytool("-debug " + arg); |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
162 |
} |
f47c18852172
8192988: keytool should support -storepasswd for pkcs12 keystores
weijun
parents:
diff
changeset
|
163 |
} |