author | weijun |
Fri, 15 Nov 2019 09:06:58 +0800 | |
changeset 59104 | 046e4024e55a |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
39886
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
1 |
/* |
59104 | 2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
39886
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
4 |
* |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
8 |
* |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
13 |
* accompanied this code). |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
14 |
* |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
18 |
* |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
21 |
* questions. |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
22 |
*/ |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
23 |
|
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
24 |
/* |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
25 |
* @test |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
26 |
* @bug 8162752 |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
27 |
* @summary keytool -importkeystore should probe srcstoretype if not specified |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
28 |
* @modules java.base/sun.security.tools.keytool |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
29 |
*/ |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
30 |
|
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
31 |
import sun.security.tools.keytool.Main; |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
32 |
|
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
33 |
public class HasSrcStoretypeOption { |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
34 |
|
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
35 |
public static void main(String[] args) throws Exception { |
59104 | 36 |
run("-genkeypair -keyalg DSA -alias a -dname CN=A -storetype jceks -keystore jce"); |
39886
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
37 |
// When there is no -srcstoretype, it should be probed from the file |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
38 |
run("-importkeystore -srckeystore jce -destkeystore jks -deststoretype jks"); |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
39 |
} |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
40 |
|
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
41 |
private static void run(String cmd) throws Exception { |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
42 |
cmd += " -debug -storepass changeit -keypass changeit -srcstorepass changeit"; |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
43 |
Main.main(cmd.split(" ")); |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
44 |
} |
a0a3c3b2636e
8162752: keytool -importkeystore should probe srcstoretype if not specified
weijun
parents:
diff
changeset
|
45 |
} |