Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java
32288 views
1
/*
2
* Copyright (c) 2005, 2020, 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.mscapi;
27
28
import java.security.AccessController;
29
import java.security.PrivilegedAction;
30
import java.security.Provider;
31
import java.util.HashMap;
32
import java.util.Map;
33
34
import sun.security.action.PutAllAction;
35
36
37
/**
38
* A Cryptographic Service Provider for the Microsoft Crypto API.
39
*
40
* @since 1.6
41
*/
42
43
public final class SunMSCAPI extends Provider {
44
45
private static final long serialVersionUID = 8622598936488630849L; //TODO
46
47
private static final String INFO = "Sun's Microsoft Crypto API provider";
48
49
static {
50
AccessController.doPrivileged(new PrivilegedAction<Void>() {
51
public Void run() {
52
System.loadLibrary("sunmscapi");
53
return null;
54
}
55
});
56
}
57
58
public SunMSCAPI() {
59
super("SunMSCAPI", 1.8d, INFO);
60
61
// if there is no security manager installed, put directly into
62
// the provider. Otherwise, create a temporary map and use a
63
// doPrivileged() call at the end to transfer the contents
64
final Map<Object, Object> map =
65
(System.getSecurityManager() == null)
66
? this : new HashMap<Object, Object>();
67
68
/*
69
* Secure random
70
*/
71
map.put("SecureRandom.Windows-PRNG", "sun.security.mscapi.PRNG");
72
73
/*
74
* Key store
75
*/
76
map.put("KeyStore.Windows-MY", "sun.security.mscapi.CKeyStore$MY");
77
map.put("KeyStore.Windows-ROOT", "sun.security.mscapi.CKeyStore$ROOT");
78
79
/*
80
* Signature engines
81
*/
82
// NONEwithRSA must be supplied with a pre-computed message digest.
83
// Only the following digest algorithms are supported: MD5, SHA-1,
84
// SHA-256, SHA-384, SHA-512 and a special-purpose digest
85
// algorithm which is a concatenation of SHA-1 and MD5 digests.
86
map.put("Signature.NONEwithRSA",
87
"sun.security.mscapi.CSignature$NONEwithRSA");
88
map.put("Signature.SHA1withRSA",
89
"sun.security.mscapi.CSignature$SHA1withRSA");
90
map.put("Signature.SHA256withRSA",
91
"sun.security.mscapi.CSignature$SHA256withRSA");
92
map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11", "SHA256withRSA");
93
map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.11", "SHA256withRSA");
94
map.put("Signature.SHA384withRSA",
95
"sun.security.mscapi.CSignature$SHA384withRSA");
96
map.put("Alg.Alias.Signature.1.2.840.113549.1.1.12", "SHA384withRSA");
97
map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.12", "SHA384withRSA");
98
map.put("Signature.SHA512withRSA",
99
"sun.security.mscapi.CSignature$SHA512withRSA");
100
map.put("Alg.Alias.Signature.1.2.840.113549.1.1.13", "SHA512withRSA");
101
map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.13", "SHA512withRSA");
102
103
map.put("Signature.MD5withRSA",
104
"sun.security.mscapi.CSignature$MD5withRSA");
105
map.put("Signature.MD2withRSA",
106
"sun.security.mscapi.CSignature$MD2withRSA");
107
108
map.put("Signature.RSASSA-PSS",
109
"sun.security.mscapi.CSignature$PSS");
110
map.put("Alg.Alias.Signature.1.2.840.113549.1.1.10", "RSASSA-PSS");
111
map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.10", "RSASSA-PSS");
112
113
map.put("Signature.SHA1withECDSA",
114
"sun.security.mscapi.CSignature$SHA1withECDSA");
115
map.put("Alg.Alias.Signature.1.2.840.10045.4.1", "SHA1withECDSA");
116
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.1", "SHA1withECDSA");
117
map.put("Signature.SHA224withECDSA",
118
"sun.security.mscapi.CSignature$SHA224withECDSA");
119
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.1", "SHA224withECDSA");
120
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.1", "SHA224withECDSA");
121
map.put("Signature.SHA256withECDSA",
122
"sun.security.mscapi.CSignature$SHA256withECDSA");
123
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.2", "SHA256withECDSA");
124
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.2", "SHA256withECDSA");
125
map.put("Signature.SHA384withECDSA",
126
"sun.security.mscapi.CSignature$SHA384withECDSA");
127
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.3", "SHA384withECDSA");
128
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.3", "SHA384withECDSA");
129
map.put("Signature.SHA512withECDSA",
130
"sun.security.mscapi.CSignature$SHA512withECDSA");
131
map.put("Alg.Alias.Signature.1.2.840.10045.4.3.4", "SHA512withECDSA");
132
map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.4", "SHA512withECDSA");
133
134
// supported key classes
135
map.put("Signature.NONEwithRSA SupportedKeyClasses",
136
"sun.security.mscapi.CKey");
137
map.put("Signature.SHA1withRSA SupportedKeyClasses",
138
"sun.security.mscapi.CKey");
139
map.put("Signature.SHA256withRSA SupportedKeyClasses",
140
"sun.security.mscapi.CKey");
141
map.put("Signature.SHA384withRSA SupportedKeyClasses",
142
"sun.security.mscapi.CKey");
143
map.put("Signature.SHA512withRSA SupportedKeyClasses",
144
"sun.security.mscapi.CKey");
145
map.put("Signature.MD5withRSA SupportedKeyClasses",
146
"sun.security.mscapi.CKey");
147
map.put("Signature.MD2withRSA SupportedKeyClasses",
148
"sun.security.mscapi.CKey");
149
150
map.put("Signature.RSASSA-PSS SupportedKeyClasses",
151
"sun.security.mscapi.CKey");
152
153
map.put("Signature.SHA1withECDSA SupportedKeyClasses",
154
"sun.security.mscapi.CKey");
155
map.put("Signature.SHA224withECDSA SupportedKeyClasses",
156
"sun.security.mscapi.CKey");
157
map.put("Signature.SHA256withECDSA SupportedKeyClasses",
158
"sun.security.mscapi.CKey");
159
map.put("Signature.SHA384withECDSA SupportedKeyClasses",
160
"sun.security.mscapi.CKey");
161
map.put("Signature.SHA512withECDSA SupportedKeyClasses",
162
"sun.security.mscapi.CKey");
163
164
/*
165
* Key Pair Generator engines
166
*/
167
map.put("KeyPairGenerator.RSA",
168
"sun.security.mscapi.CKeyPairGenerator$RSA");
169
map.put("KeyPairGenerator.RSA KeySize", "1024");
170
171
/*
172
* Cipher engines
173
*/
174
map.put("Cipher.RSA", "sun.security.mscapi.CRSACipher");
175
map.put("Cipher.RSA/ECB/PKCS1Padding",
176
"sun.security.mscapi.CRSACipher");
177
map.put("Cipher.RSA SupportedModes", "ECB");
178
map.put("Cipher.RSA SupportedPaddings", "PKCS1PADDING");
179
map.put("Cipher.RSA SupportedKeyClasses", "sun.security.mscapi.CKey");
180
181
if (map != this) {
182
AccessController.doPrivileged(new PutAllAction(this, map));
183
}
184
}
185
}
186
187