Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/src/java.base/share/classes/sun/security/util/KnownOIDs.java
58327 views
1
/*
2
* Copyright (c) 2020, 2021, 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.util;
27
28
import java.util.List;
29
import java.util.Locale;
30
import java.util.Objects;
31
import java.util.concurrent.ConcurrentHashMap;
32
33
/**
34
* This utility class maps algorithm name to the corresponding oid strings.
35
* NOTE: for 100% backward compatibility, the standard name for the enum
36
* is determined by existing usage and may be in lowercase/uppercase in
37
* order to match existing output.
38
*/
39
public enum KnownOIDs {
40
41
// X.500 Attributes 2.5.4.*
42
CommonName("2.5.4.3"),
43
Surname("2.5.4.4"),
44
SerialNumber("2.5.4.5"),
45
CountryName("2.5.4.6"),
46
LocalityName("2.5.4.7"),
47
StateName("2.5.4.8"),
48
StreetAddress("2.5.4.9"),
49
OrgName("2.5.4.10"),
50
OrgUnitName("2.5.4.11"),
51
Title("2.5.4.12"),
52
GivenName("2.5.4.42"),
53
Initials("2.5.4.43"),
54
GenerationQualifier("2.5.4.44"),
55
DNQualifier("2.5.4.46"),
56
57
// Certificate Extension 2.5.29.*
58
SubjectDirectoryAttributes("2.5.29.9"),
59
SubjectKeyID("2.5.29.14"),
60
KeyUsage("2.5.29.15"),
61
PrivateKeyUsage("2.5.29.16"),
62
SubjectAlternativeName("2.5.29.17"),
63
IssuerAlternativeName("2.5.29.18"),
64
BasicConstraints("2.5.29.19"),
65
CRLNumber("2.5.29.20"),
66
ReasonCode("2.5.29.21"),
67
HoldInstructionCode("2.5.29.23"),
68
InvalidityDate("2.5.29.24"),
69
DeltaCRLIndicator("2.5.29.27"),
70
IssuingDistributionPoint("2.5.29.28"),
71
CertificateIssuer("2.5.29.29"),
72
NameConstraints("2.5.29.30"),
73
CRLDistributionPoints("2.5.29.31"),
74
CertificatePolicies("2.5.29.32"),
75
CE_CERT_POLICIES_ANY("2.5.29.32.0"),
76
PolicyMappings("2.5.29.33"),
77
AuthorityKeyID("2.5.29.35"),
78
PolicyConstraints("2.5.29.36"),
79
extendedKeyUsage("2.5.29.37"),
80
anyExtendedKeyUsage("2.5.29.37.0"),
81
FreshestCRL("2.5.29.46"),
82
InhibitAnyPolicy("2.5.29.54"),
83
84
// PKIX 1.3.6.1.5.5.7.
85
AuthInfoAccess("1.3.6.1.5.5.7.1.1"),
86
SubjectInfoAccess("1.3.6.1.5.5.7.1.11"),
87
// key usage purposes - PKIX.3.*
88
serverAuth("1.3.6.1.5.5.7.3.1"),
89
clientAuth("1.3.6.1.5.5.7.3.2"),
90
codeSigning("1.3.6.1.5.5.7.3.3"),
91
emailProtection("1.3.6.1.5.5.7.3.4"),
92
ipsecEndSystem("1.3.6.1.5.5.7.3.5"),
93
ipsecTunnel("1.3.6.1.5.5.7.3.6"),
94
ipsecUser("1.3.6.1.5.5.7.3.7"),
95
KP_TimeStamping("1.3.6.1.5.5.7.3.8", "timeStamping") {
96
@Override
97
boolean registerNames() { return false; }
98
},
99
OCSPSigning("1.3.6.1.5.5.7.3.9"),
100
// access descriptors - PKIX.48.*
101
OCSP("1.3.6.1.5.5.7.48.1"),
102
OCSPBasicResponse("1.3.6.1.5.5.7.48.1.1"),
103
OCSPNonceExt("1.3.6.1.5.5.7.48.1.2"),
104
OCSPNoCheck("1.3.6.1.5.5.7.48.1.5"),
105
caIssuers("1.3.6.1.5.5.7.48.2"),
106
AD_TimeStamping("1.3.6.1.5.5.7.48.3", "timeStamping") {
107
@Override
108
boolean registerNames() { return false; }
109
},
110
caRepository("1.3.6.1.5.5.7.48.5", "caRepository"),
111
112
// NIST --
113
// AES 2.16.840.1.101.3.4.1.*
114
AES("2.16.840.1.101.3.4.1"),
115
AES_128$ECB$NoPadding("2.16.840.1.101.3.4.1.1", "AES_128/ECB/NoPadding"),
116
AES_128$CBC$NoPadding("2.16.840.1.101.3.4.1.2", "AES_128/CBC/NoPadding"),
117
AES_128$OFB$NoPadding("2.16.840.1.101.3.4.1.3", "AES_128/OFB/NoPadding"),
118
AES_128$CFB$NoPadding("2.16.840.1.101.3.4.1.4", "AES_128/CFB/NoPadding"),
119
AES_128$KW$NoPadding("2.16.840.1.101.3.4.1.5", "AES_128/KW/NoPadding",
120
"AESWrap_128"),
121
AES_128$GCM$NoPadding("2.16.840.1.101.3.4.1.6", "AES_128/GCM/NoPadding"),
122
AES_128$KWP$NoPadding("2.16.840.1.101.3.4.1.8", "AES_128/KWP/NoPadding",
123
"AESWrapPad_128"),
124
125
AES_192$ECB$NoPadding("2.16.840.1.101.3.4.1.21", "AES_192/ECB/NoPadding"),
126
AES_192$CBC$NoPadding("2.16.840.1.101.3.4.1.22", "AES_192/CBC/NoPadding"),
127
AES_192$OFB$NoPadding("2.16.840.1.101.3.4.1.23", "AES_192/OFB/NoPadding"),
128
AES_192$CFB$NoPadding("2.16.840.1.101.3.4.1.24", "AES_192/CFB/NoPadding"),
129
AES_192$KW$NoPadding("2.16.840.1.101.3.4.1.25", "AES_192/KW/NoPadding",
130
"AESWrap_192"),
131
AES_192$GCM$NoPadding("2.16.840.1.101.3.4.1.26", "AES_192/GCM/NoPadding"),
132
AES_192$KWP$NoPadding("2.16.840.1.101.3.4.1.28", "AES_192/KWP/NoPadding",
133
"AESWrapPad_192"),
134
135
AES_256$ECB$NoPadding("2.16.840.1.101.3.4.1.41", "AES_256/ECB/NoPadding"),
136
AES_256$CBC$NoPadding("2.16.840.1.101.3.4.1.42", "AES_256/CBC/NoPadding"),
137
AES_256$OFB$NoPadding("2.16.840.1.101.3.4.1.43", "AES_256/OFB/NoPadding"),
138
AES_256$CFB$NoPadding("2.16.840.1.101.3.4.1.44", "AES_256/CFB/NoPadding"),
139
AES_256$KW$NoPadding("2.16.840.1.101.3.4.1.45", "AES_256/KW/NoPadding",
140
"AESWrap_256"),
141
AES_256$GCM$NoPadding("2.16.840.1.101.3.4.1.46", "AES_256/GCM/NoPadding"),
142
AES_256$KWP$NoPadding("2.16.840.1.101.3.4.1.48", "AES_256/KWP/NoPadding",
143
"AESWrapPad_256"),
144
145
// hashAlgs 2.16.840.1.101.3.4.2.*
146
SHA_256("2.16.840.1.101.3.4.2.1", "SHA-256", "SHA256"),
147
SHA_384("2.16.840.1.101.3.4.2.2", "SHA-384", "SHA384"),
148
SHA_512("2.16.840.1.101.3.4.2.3", "SHA-512", "SHA512"),
149
SHA_224("2.16.840.1.101.3.4.2.4", "SHA-224", "SHA224"),
150
SHA_512$224("2.16.840.1.101.3.4.2.5", "SHA-512/224", "SHA512/224"),
151
SHA_512$256("2.16.840.1.101.3.4.2.6", "SHA-512/256", "SHA512/256"),
152
SHA3_224("2.16.840.1.101.3.4.2.7", "SHA3-224"),
153
SHA3_256("2.16.840.1.101.3.4.2.8", "SHA3-256"),
154
SHA3_384("2.16.840.1.101.3.4.2.9", "SHA3-384"),
155
SHA3_512("2.16.840.1.101.3.4.2.10", "SHA3-512"),
156
SHAKE128("2.16.840.1.101.3.4.2.11"),
157
SHAKE256("2.16.840.1.101.3.4.2.12"),
158
HmacSHA3_224("2.16.840.1.101.3.4.2.13", "HmacSHA3-224"),
159
HmacSHA3_256("2.16.840.1.101.3.4.2.14", "HmacSHA3-256"),
160
HmacSHA3_384("2.16.840.1.101.3.4.2.15", "HmacSHA3-384"),
161
HmacSHA3_512("2.16.840.1.101.3.4.2.16", "HmacSHA3-512"),
162
SHAKE128_LEN("2.16.840.1.101.3.4.2.17", "SHAKE128-LEN"),
163
SHAKE256_LEN("2.16.840.1.101.3.4.2.18", "SHAKE256-LEN"),
164
165
// sigAlgs 2.16.840.1.101.3.4.3.*
166
SHA224withDSA("2.16.840.1.101.3.4.3.1"),
167
SHA256withDSA("2.16.840.1.101.3.4.3.2"),
168
SHA384withDSA("2.16.840.1.101.3.4.3.3"),
169
SHA512withDSA("2.16.840.1.101.3.4.3.4"),
170
SHA3_224withDSA("2.16.840.1.101.3.4.3.5", "SHA3-224withDSA"),
171
SHA3_256withDSA("2.16.840.1.101.3.4.3.6", "SHA3-256withDSA"),
172
SHA3_384withDSA("2.16.840.1.101.3.4.3.7", "SHA3-384withDSA"),
173
SHA3_512withDSA("2.16.840.1.101.3.4.3.8", "SHA3-512withDSA"),
174
SHA3_224withECDSA("2.16.840.1.101.3.4.3.9", "SHA3-224withECDSA"),
175
SHA3_256withECDSA("2.16.840.1.101.3.4.3.10", "SHA3-256withECDSA"),
176
SHA3_384withECDSA("2.16.840.1.101.3.4.3.11", "SHA3-384withECDSA"),
177
SHA3_512withECDSA("2.16.840.1.101.3.4.3.12", "SHA3-512withECDSA"),
178
SHA3_224withRSA("2.16.840.1.101.3.4.3.13", "SHA3-224withRSA"),
179
SHA3_256withRSA("2.16.840.1.101.3.4.3.14", "SHA3-256withRSA"),
180
SHA3_384withRSA("2.16.840.1.101.3.4.3.15", "SHA3-384withRSA"),
181
SHA3_512withRSA("2.16.840.1.101.3.4.3.16", "SHA3-512withRSA"),
182
183
// RSASecurity
184
// PKCS1 1.2.840.113549.1.1.*
185
PKCS1("1.2.840.113549.1.1", "RSA") { // RSA KeyPairGenerator and KeyFactory
186
@Override
187
boolean registerNames() { return false; }
188
},
189
RSA("1.2.840.113549.1.1.1"), // RSA encryption
190
191
MD2withRSA("1.2.840.113549.1.1.2"),
192
MD5withRSA("1.2.840.113549.1.1.4"),
193
SHA1withRSA("1.2.840.113549.1.1.5"),
194
OAEP("1.2.840.113549.1.1.7"),
195
MGF1("1.2.840.113549.1.1.8"),
196
PSpecified("1.2.840.113549.1.1.9"),
197
RSASSA_PSS("1.2.840.113549.1.1.10", "RSASSA-PSS", "PSS"),
198
SHA256withRSA("1.2.840.113549.1.1.11"),
199
SHA384withRSA("1.2.840.113549.1.1.12"),
200
SHA512withRSA("1.2.840.113549.1.1.13"),
201
SHA224withRSA("1.2.840.113549.1.1.14"),
202
SHA512$224withRSA("1.2.840.113549.1.1.15", "SHA512/224withRSA"),
203
SHA512$256withRSA("1.2.840.113549.1.1.16", "SHA512/256withRSA"),
204
205
// PKCS3 1.2.840.113549.1.3.*
206
DiffieHellman("1.2.840.113549.1.3.1", "DiffieHellman", "DH"),
207
208
// PKCS5 1.2.840.113549.1.5.*
209
PBEWithMD5AndDES("1.2.840.113549.1.5.3"),
210
PBEWithMD5AndRC2("1.2.840.113549.1.5.6"),
211
PBEWithSHA1AndDES("1.2.840.113549.1.5.10"),
212
PBEWithSHA1AndRC2("1.2.840.113549.1.5.11"),
213
PBKDF2WithHmacSHA1("1.2.840.113549.1.5.12"),
214
PBES2("1.2.840.113549.1.5.13"),
215
216
// PKCS7 1.2.840.113549.1.7.*
217
PKCS7("1.2.840.113549.1.7"),
218
Data("1.2.840.113549.1.7.1"),
219
SignedData("1.2.840.113549.1.7.2"),
220
JDK_OLD_Data("1.2.840.1113549.1.7.1"), // extra 1 in 4th component
221
JDK_OLD_SignedData("1.2.840.1113549.1.7.2"),
222
EnvelopedData("1.2.840.113549.1.7.3"),
223
SignedAndEnvelopedData("1.2.840.113549.1.7.4"),
224
DigestedData("1.2.840.113549.1.7.5"),
225
EncryptedData("1.2.840.113549.1.7.6"),
226
227
// PKCS9 1.2.840.113549.1.9.*
228
EmailAddress("1.2.840.113549.1.9.1"),
229
UnstructuredName("1.2.840.113549.1.9.2"),
230
ContentType("1.2.840.113549.1.9.3"),
231
MessageDigest("1.2.840.113549.1.9.4"),
232
SigningTime("1.2.840.113549.1.9.5"),
233
CounterSignature("1.2.840.113549.1.9.6"),
234
ChallengePassword("1.2.840.113549.1.9.7"),
235
UnstructuredAddress("1.2.840.113549.1.9.8"),
236
ExtendedCertificateAttributes("1.2.840.113549.1.9.9"),
237
IssuerAndSerialNumber("1.2.840.113549.1.9.10"),
238
ExtensionRequest("1.2.840.113549.1.9.14"),
239
SMIMECapability("1.2.840.113549.1.9.15"),
240
TimeStampTokenInfo("1.2.840.113549.1.9.16.1.4"),
241
SigningCertificate("1.2.840.113549.1.9.16.2.12"),
242
SignatureTimestampToken("1.2.840.113549.1.9.16.2.14"),
243
CHACHA20_POLY1305("1.2.840.113549.1.9.16.3.18", "CHACHA20-POLY1305"),
244
FriendlyName("1.2.840.113549.1.9.20"),
245
LocalKeyID("1.2.840.113549.1.9.21"),
246
CertTypeX509("1.2.840.113549.1.9.22.1"),
247
CMSAlgorithmProtection("1.2.840.113549.1.9.52"),
248
249
// PKCS12 1.2.840.113549.1.12.*
250
PBEWithSHA1AndRC4_128("1.2.840.113549.1.12.1.1"),
251
PBEWithSHA1AndRC4_40("1.2.840.113549.1.12.1.2"),
252
PBEWithSHA1AndDESede("1.2.840.113549.1.12.1.3"),
253
PBEWithSHA1AndRC2_128("1.2.840.113549.1.12.1.5"),
254
PBEWithSHA1AndRC2_40("1.2.840.113549.1.12.1.6"),
255
PKCS8ShroudedKeyBag("1.2.840.113549.1.12.10.1.2"),
256
CertBag("1.2.840.113549.1.12.10.1.3"),
257
SecretBag("1.2.840.113549.1.12.10.1.5"),
258
259
// digestAlgs 1.2.840.113549.2.*
260
MD2("1.2.840.113549.2.2"),
261
MD5("1.2.840.113549.2.5"),
262
HmacSHA1("1.2.840.113549.2.7"),
263
HmacSHA224("1.2.840.113549.2.8"),
264
HmacSHA256("1.2.840.113549.2.9"),
265
HmacSHA384("1.2.840.113549.2.10"),
266
HmacSHA512("1.2.840.113549.2.11"),
267
HmacSHA512$224("1.2.840.113549.2.12", "HmacSHA512/224"),
268
HmacSHA512$256("1.2.840.113549.2.13", "HmacSHA512/256"),
269
270
// encryptionAlgs 1.2.840.113549.3.*
271
RC2$CBC$PKCS5Padding("1.2.840.113549.3.2", "RC2/CBC/PKCS5Padding"),
272
ARCFOUR("1.2.840.113549.3.4", "ARCFOUR", "RC4"),
273
DESede$CBC$NoPadding("1.2.840.113549.3.7", "DESede/CBC/NoPadding"),
274
RC5$CBC$PKCS5Padding("1.2.840.113549.3.9", "RC5/CBC/PKCS5Padding"),
275
276
// ANSI --
277
// X9 1.2.840.10040.4.*
278
DSA("1.2.840.10040.4.1"),
279
SHA1withDSA("1.2.840.10040.4.3", "SHA1withDSA", "DSS"),
280
// X9.62 1.2.840.10045.*
281
EC("1.2.840.10045.2.1"),
282
283
//c2pnb163v1("1.2.840.10045.3.0.1", "X9.62 c2pnb163v1"),
284
//c2pnb163v2("1.2.840.10045.3.0.2", "X9.62 c2pnb163v2"),
285
//c2pnb163v3("1.2.840.10045.3.0.3", "X9.62 c2pnb163v3"),
286
//c2pnb176w1("1.2.840.10045.3.0.4", "X9.62 c2pnb176w1"),
287
c2tnb191v1("1.2.840.10045.3.0.5", "X9.62 c2tnb191v1"),
288
c2tnb191v2("1.2.840.10045.3.0.6", "X9.62 c2tnb191v2"),
289
c2tnb191v3("1.2.840.10045.3.0.7", "X9.62 c2tnb191v3"),
290
//c2pnb208w1("1.2.840.10045.3.0.10", "X9.62 c2pnb208w1"),
291
c2tnb239v1("1.2.840.10045.3.0.11", "X9.62 c2tnb239v1"),
292
c2tnb239v2("1.2.840.10045.3.0.12", "X9.62 c2tnb239v2"),
293
c2tnb239v3("1.2.840.10045.3.0.13", "X9.62 c2tnb239v3"),
294
//c2pnb272w1("1.2.840.10045.3.0.16", "X9.62 c2pnb272w1"),
295
//c2pnb304w1("1.2.840.10045.3.0.17", "X9.62 c2pnb304w1"),
296
c2tnb359v1("1.2.840.10045.3.0.18", "X9.62 c2tnb359v1"),
297
//c2pnb368w1("1.2.840.10045.3.0.19", "X9.62 c2pnb368w1"),
298
c2tnb431r1("1.2.840.10045.3.0.20", "X9.62 c2tnb431r1"),
299
300
secp192r1("1.2.840.10045.3.1.1",
301
"secp192r1", "NIST P-192", "X9.62 prime192v1"),
302
prime192v2("1.2.840.10045.3.1.2", "X9.62 prime192v2"),
303
prime192v3("1.2.840.10045.3.1.3", "X9.62 prime192v3"),
304
prime239v1("1.2.840.10045.3.1.4", "X9.62 prime239v1"),
305
prime239v2("1.2.840.10045.3.1.5", "X9.62 prime239v2"),
306
prime239v3("1.2.840.10045.3.1.6", "X9.62 prime239v3"),
307
secp256r1("1.2.840.10045.3.1.7",
308
"secp256r1", "NIST P-256", "X9.62 prime256v1"),
309
SHA1withECDSA("1.2.840.10045.4.1"),
310
SHA224withECDSA("1.2.840.10045.4.3.1"),
311
SHA256withECDSA("1.2.840.10045.4.3.2"),
312
SHA384withECDSA("1.2.840.10045.4.3.3"),
313
SHA512withECDSA("1.2.840.10045.4.3.4"),
314
SpecifiedSHA2withECDSA("1.2.840.10045.4.3"),
315
316
// X9.42 1.2.840.10046.2.*
317
X942_DH("1.2.840.10046.2.1", "DiffieHellman") { // unused by JDK providers
318
@Override
319
boolean registerNames() { return false; }
320
},
321
322
// Teletrust 1.3.36.*
323
brainpoolP160r1("1.3.36.3.3.2.8.1.1.1"),
324
brainpoolP192r1("1.3.36.3.3.2.8.1.1.3"),
325
brainpoolP224r1("1.3.36.3.3.2.8.1.1.5"),
326
brainpoolP256r1("1.3.36.3.3.2.8.1.1.7"),
327
brainpoolP320r1("1.3.36.3.3.2.8.1.1.9"),
328
brainpoolP384r1("1.3.36.3.3.2.8.1.1.11"),
329
brainpoolP512r1("1.3.36.3.3.2.8.1.1.13"),
330
331
// Certicom 1.3.132.*
332
sect163k1("1.3.132.0.1", "sect163k1", "NIST K-163"),
333
sect163r1("1.3.132.0.2"),
334
sect239k1("1.3.132.0.3"),
335
sect113r1("1.3.132.0.4"),
336
sect113r2("1.3.132.0.5"),
337
secp112r1("1.3.132.0.6"),
338
secp112r2("1.3.132.0.7"),
339
secp160r1("1.3.132.0.8"),
340
secp160k1("1.3.132.0.9"),
341
secp256k1("1.3.132.0.10"),
342
sect163r2("1.3.132.0.15", "sect163r2", "NIST B-163"),
343
sect283k1("1.3.132.0.16", "sect283k1", "NIST K-283"),
344
sect283r1("1.3.132.0.17", "sect283r1", "NIST B-283"),
345
346
sect131r1("1.3.132.0.22"),
347
sect131r2("1.3.132.0.23"),
348
sect193r1("1.3.132.0.24"),
349
sect193r2("1.3.132.0.25"),
350
sect233k1("1.3.132.0.26", "sect233k1", "NIST K-233"),
351
sect233r1("1.3.132.0.27", "sect233r1", "NIST B-233"),
352
secp128r1("1.3.132.0.28"),
353
secp128r2("1.3.132.0.29"),
354
secp160r2("1.3.132.0.30"),
355
secp192k1("1.3.132.0.31"),
356
secp224k1("1.3.132.0.32"),
357
secp224r1("1.3.132.0.33", "secp224r1", "NIST P-224"),
358
secp384r1("1.3.132.0.34", "secp384r1", "NIST P-384"),
359
secp521r1("1.3.132.0.35", "secp521r1", "NIST P-521"),
360
sect409k1("1.3.132.0.36", "sect409k1", "NIST K-409"),
361
sect409r1("1.3.132.0.37", "sect409r1", "NIST B-409"),
362
sect571k1("1.3.132.0.38", "sect571k1", "NIST K-571"),
363
sect571r1("1.3.132.0.39", "sect571r1", "NIST B-571"),
364
365
ECDH("1.3.132.1.12"),
366
367
// OIW secsig 1.3.14.3.*
368
OIW_DES_CBC("1.3.14.3.2.7", "DES/CBC", "DES"),
369
370
OIW_DSA("1.3.14.3.2.12", "DSA") {
371
@Override
372
boolean registerNames() { return false; }
373
},
374
375
OIW_JDK_SHA1withDSA("1.3.14.3.2.13", "SHA1withDSA") {
376
@Override
377
boolean registerNames() { return false; }
378
},
379
380
OIW_SHA1withRSA_Odd("1.3.14.3.2.15", "SHA1withRSA") {
381
@Override
382
boolean registerNames() { return false; }
383
},
384
385
DESede("1.3.14.3.2.17", "DESede"),
386
387
SHA_1("1.3.14.3.2.26", "SHA-1", "SHA", "SHA1"),
388
389
OIW_SHA1withDSA("1.3.14.3.2.27", "SHA1withDSA") {
390
@Override
391
boolean registerNames() { return false; }
392
},
393
394
OIW_SHA1withRSA("1.3.14.3.2.29", "SHA1withRSA") {
395
@Override
396
boolean registerNames() { return false; }
397
},
398
399
// Thawte 1.3.101.*
400
X25519("1.3.101.110"),
401
X448("1.3.101.111"),
402
Ed25519("1.3.101.112"),
403
Ed448("1.3.101.113"),
404
405
// University College London (UCL) 0.9.2342.19200300.*
406
UCL_UserID("0.9.2342.19200300.100.1.1"),
407
UCL_DomainComponent("0.9.2342.19200300.100.1.25"),
408
409
// Netscape 2.16.840.1.113730.*
410
NETSCAPE_CertType("2.16.840.1.113730.1.1"),
411
NETSCAPE_CertSequence("2.16.840.1.113730.2.5"),
412
NETSCAPE_ExportApproved("2.16.840.1.113730.4.1"),
413
414
// Oracle 2.16.840.1.113894.*
415
ORACLE_TrustedKeyUsage("2.16.840.1.113894.746875.1.1"),
416
417
// Miscellaneous oids below which are legacy, and not well known
418
// Consider removing them in future releases when their usage
419
// have died out
420
421
ITUX509_RSA("2.5.8.1.1", "RSA") { // unused by JDK providers
422
// defined in X.509 for RSA keys
423
@Override // with modulus length as its parameter
424
boolean registerNames() { return false; }
425
},
426
427
SkipIPAddress("1.3.6.1.4.1.42.2.11.2.1"),
428
JAVASOFT_JDKKeyProtector("1.3.6.1.4.1.42.2.17.1.1"),
429
JAVASOFT_JCEKeyProtector("1.3.6.1.4.1.42.2.19.1"),
430
MICROSOFT_ExportApproved("1.3.6.1.4.1.311.10.3.3");
431
432
private String stdName;
433
private String oid;
434
private String[] aliases;
435
436
// find the matching enum using either name or oid string
437
// return null if no match found
438
public static KnownOIDs findMatch(String s) {
439
s = s.toUpperCase(Locale.ENGLISH);
440
KnownOIDs res = name2enum.get(s);
441
if (res == null && debug != null) {
442
debug.println("No KnownOIDs enum found for " + s);
443
}
444
return res;
445
}
446
447
private static final Debug debug = Debug.getInstance("jca");
448
//private static final java.io.PrintStream debug = System.out;
449
private static final ConcurrentHashMap<String, KnownOIDs> name2enum =
450
new ConcurrentHashMap<>();
451
452
static {
453
if (debug != null) {
454
debug.println("Setting up name2enum:");
455
}
456
for (KnownOIDs o : KnownOIDs.values()) {
457
register(o);
458
};
459
}
460
461
private static void register(KnownOIDs o) {
462
KnownOIDs ov = name2enum.put(o.oid, o);
463
if (ov != null) {
464
throw new RuntimeException("ERROR: Duplicate " + o.oid +
465
" between " + o + " and " + ov);
466
} else if (debug != null) {
467
debug.println(o.oid + " => " + o.name());
468
}
469
// only register the stdName and aliases if o.registerNames()
470
// returns true
471
if (o.registerNames()) {
472
String stdNameUpper = o.stdName.toUpperCase(Locale.ENGLISH);
473
if (Objects.nonNull(name2enum.put(stdNameUpper, o))) {
474
throw new RuntimeException("ERROR: Duplicate " +
475
stdNameUpper + " exists already");
476
}
477
if (debug != null) {
478
debug.println(stdNameUpper + " => " + o.name());
479
}
480
481
for (String a : o.aliases) {
482
String aliasUpper = a.toUpperCase(Locale.ENGLISH);
483
if (Objects.nonNull(name2enum.put(aliasUpper, o))) {
484
throw new RuntimeException("ERROR: Duplicate " +
485
aliasUpper + " exists already");
486
}
487
if (debug != null) {
488
debug.println(aliasUpper + " => " + o.name());
489
}
490
}
491
}
492
}
493
494
private KnownOIDs(String oid) {
495
this.oid = oid;
496
this.stdName = name(); // defaults to enum name
497
this.aliases = new String[0];
498
}
499
500
private KnownOIDs(String oid, String stdName, String ... aliases) {
501
this.oid = oid;
502
this.stdName = stdName;
503
this.aliases = aliases;
504
}
505
506
// returns the oid string associated with this enum
507
public String value() {
508
return oid;
509
}
510
511
// returns the user-friendly standard algorithm name
512
public String stdName() {
513
return stdName;
514
}
515
516
// return the internal aliases
517
public String[] aliases() {
518
return aliases;
519
}
520
521
boolean registerNames() {
522
return true;
523
}
524
}
525
526