Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/ec/SunECEntries.java
38830 views
1
/*
2
* Copyright (c) 2009, 2014, 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. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.security.ec;
27
28
import java.util.Collection;
29
import java.util.Map;
30
31
import java.util.regex.Pattern;
32
import sun.security.util.CurveDB;
33
import sun.security.util.NamedCurve;
34
35
/**
36
* Defines the entries of the SunEC provider.
37
*
38
* @since 1.7
39
*/
40
final class SunECEntries {
41
42
private SunECEntries() {
43
// empty
44
}
45
46
static void putEntries(Map<Object, Object> map,
47
boolean useFullImplementation) {
48
49
/*
50
* Key Factory engine
51
*/
52
map.put("KeyFactory.EC", "sun.security.ec.ECKeyFactory");
53
map.put("Alg.Alias.KeyFactory.EllipticCurve", "EC");
54
55
map.put("KeyFactory.EC ImplementedIn", "Software");
56
57
/*
58
* Algorithm Parameter engine
59
*/
60
map.put("AlgorithmParameters.EC", "sun.security.util.ECParameters");
61
map.put("Alg.Alias.AlgorithmParameters.EllipticCurve", "EC");
62
map.put("Alg.Alias.AlgorithmParameters.1.2.840.10045.2.1", "EC");
63
64
map.put("AlgorithmParameters.EC KeySize", "256");
65
66
map.put("AlgorithmParameters.EC ImplementedIn", "Software");
67
68
// "AlgorithmParameters.EC SupportedCurves" prop used by unit test
69
boolean firstCurve = true;
70
StringBuilder names = new StringBuilder();
71
Pattern nameSplitPattern = Pattern.compile(CurveDB.SPLIT_PATTERN);
72
73
Collection<? extends NamedCurve> supportedCurves =
74
CurveDB.getSupportedCurves();
75
for (NamedCurve namedCurve : supportedCurves) {
76
if (!firstCurve) {
77
names.append("|");
78
} else {
79
firstCurve = false;
80
}
81
82
names.append("[");
83
84
String[] commonNames = nameSplitPattern.split(namedCurve.getName());
85
for (String commonName : commonNames) {
86
names.append(commonName.trim());
87
names.append(",");
88
}
89
90
names.append(namedCurve.getObjectId());
91
names.append("]");
92
}
93
94
map.put("AlgorithmParameters.EC SupportedCurves", names.toString());
95
96
/*
97
* Register the algorithms below only when the full ECC implementation
98
* is available
99
*/
100
if (!useFullImplementation) {
101
return;
102
}
103
104
/*
105
* Signature engines
106
*/
107
map.put("Signature.NONEwithECDSA",
108
"sun.security.ec.ECDSASignature$Raw");
109
map.put("Signature.SHA1withECDSA",
110
"sun.security.ec.ECDSASignature$SHA1");
111
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.1", "SHA1withECDSA");
112
map.put("Alg.Alias.Signature.1.2.840.10045.4.1", "SHA1withECDSA");
113
114
map.put("Signature.SHA224withECDSA",
115
"sun.security.ec.ECDSASignature$SHA224");
116
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.1", "SHA224withECDSA");
117
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.1", "SHA224withECDSA");
118
119
map.put("Signature.SHA256withECDSA",
120
"sun.security.ec.ECDSASignature$SHA256");
121
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.2", "SHA256withECDSA");
122
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.2", "SHA256withECDSA");
123
124
map.put("Signature.SHA384withECDSA",
125
"sun.security.ec.ECDSASignature$SHA384");
126
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.3", "SHA384withECDSA");
127
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.3", "SHA384withECDSA");
128
129
map.put("Signature.SHA512withECDSA",
130
"sun.security.ec.ECDSASignature$SHA512");
131
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.4", "SHA512withECDSA");
132
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.4", "SHA512withECDSA");
133
134
String ecKeyClasses = "java.security.interfaces.ECPublicKey" +
135
"|java.security.interfaces.ECPrivateKey";
136
map.put("Signature.NONEwithECDSA SupportedKeyClasses", ecKeyClasses);
137
map.put("Signature.SHA1withECDSA SupportedKeyClasses", ecKeyClasses);
138
map.put("Signature.SHA224withECDSA SupportedKeyClasses", ecKeyClasses);
139
map.put("Signature.SHA256withECDSA SupportedKeyClasses", ecKeyClasses);
140
map.put("Signature.SHA384withECDSA SupportedKeyClasses", ecKeyClasses);
141
map.put("Signature.SHA512withECDSA SupportedKeyClasses", ecKeyClasses);
142
143
map.put("Signature.SHA1withECDSA KeySize", "256");
144
145
map.put("Signature.NONEwithECDSA ImplementedIn", "Software");
146
map.put("Signature.SHA1withECDSA ImplementedIn", "Software");
147
map.put("Signature.SHA224withECDSA ImplementedIn", "Software");
148
map.put("Signature.SHA256withECDSA ImplementedIn", "Software");
149
map.put("Signature.SHA384withECDSA ImplementedIn", "Software");
150
map.put("Signature.SHA512withECDSA ImplementedIn", "Software");
151
152
/*
153
* Key Pair Generator engine
154
*/
155
map.put("KeyPairGenerator.EC", "sun.security.ec.ECKeyPairGenerator");
156
map.put("Alg.Alias.KeyPairGenerator.EllipticCurve", "EC");
157
158
map.put("KeyPairGenerator.EC KeySize", "256");
159
160
map.put("KeyPairGenerator.EC ImplementedIn", "Software");
161
162
/*
163
* Key Agreement engine
164
*/
165
map.put("KeyAgreement.ECDH", "sun.security.ec.ECDHKeyAgreement");
166
167
map.put("KeyAgreement.ECDH SupportedKeyClasses", ecKeyClasses);
168
169
map.put("KeyAgreement.ECDH ImplementedIn", "Software");
170
}
171
}
172
173