Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/security/tools/keytool/StandardAlgName.java
41152 views
1
/*
2
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 4909889
27
* @summary KeyTool accepts any input that user make as long as we can make some
28
* sense out of it, but when comes to present the info the user, it
29
* promotes a standard look.
30
* @author Andrew Fan
31
* @library /test/lib
32
* @run main/timeout=240 StandardAlgName
33
*/
34
35
import jdk.test.lib.SecurityTools;
36
37
public class StandardAlgName {
38
public static void main(String[] args) throws Exception {
39
// CA
40
SecurityTools.keytool("-genkey", "-v", "-alias", "pkcs12testCA",
41
"-keyalg", "RsA", "-keysize", "2048",
42
"-sigalg", "ShA1wItHRSA",
43
"-dname", "cn=PKCS12 Test CA, ou = Security SQE, o = JavaSoft, c = US",
44
"-validity", "3650",
45
"-keypass", "storepass", "-keystore", "keystoreCA.jceks.data",
46
"-storepass", "storepass", "-storetype", "jceKS")
47
.shouldHaveExitValue(0)
48
.shouldNotContain("RsA")
49
.shouldNotContain("ShA1wItHRSA")
50
.shouldContain("RSA")
51
.shouldContain("SHA1withRSA");
52
53
// Lead
54
SecurityTools.keytool("-genkey", "-v", "-alias", "pkcs12testLead",
55
"-keyalg", "rSA", "-keysize", "1024",
56
"-sigalg", "mD5withRSA",
57
"-dname", "cn=PKCS12 Test Lead, ou=Security SQE, o=JavaSoft, c=US",
58
"-validity", "3650",
59
"-keypass", "storepass", "-keystore", "keystoreLead.jceks.data",
60
"-storepass", "storepass", "-storetype", "jCeks")
61
.shouldHaveExitValue(0)
62
.shouldNotContain("rSA")
63
.shouldNotContain("mD5withRSA")
64
.shouldContain("RSA")
65
.shouldContain("MD5withRSA");
66
67
// End User 1
68
SecurityTools.keytool("-genkey", "-v", "-alias", "pkcs12testEndUser1",
69
"-keyalg", "RSa", "-keysize", "1024",
70
"-sigalg", "sHa1wIThRSA",
71
"-dname", "cn=PKCS12 Test End User 1, ou=Security SQE, o=JavaSoft, c=US",
72
"-validity", "3650",
73
"-keypass", "storepass", "-keystore", "keystoreEndUser1.jceks.data",
74
"-storepass", "storepass", "-storetype", "Jceks")
75
.shouldHaveExitValue(0)
76
.shouldNotContain("RSa")
77
.shouldNotContain("sHa1wIThRSA")
78
.shouldContain("RSA")
79
.shouldContain("SHA1withRSA");
80
}
81
}
82
83