author | weijun |
Wed, 01 Aug 2018 13:35:08 +0800 | |
changeset 51272 | 9d92ff04a29c |
parent 50817 | fa1e04811ff6 |
child 52995 | 9af672cab7cb |
permissions | -rw-r--r-- |
2 | 1 |
/* |
47421
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.security.provider; |
|
27 |
||
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
28 |
import java.io.*; |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
29 |
import java.net.*; |
2 | 30 |
import java.util.Map; |
31 |
import java.security.*; |
|
50817
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47421
diff
changeset
|
32 |
|
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47421
diff
changeset
|
33 |
import jdk.internal.util.StaticProperty; |
47421
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
34 |
import sun.security.action.GetPropertyAction; |
2 | 35 |
|
36 |
/** |
|
37 |
* Defines the entries of the SUN provider. |
|
38 |
* |
|
39 |
* Algorithms supported, and their names: |
|
40 |
* |
|
41 |
* - SHA is the message digest scheme described in FIPS 180-1. |
|
42 |
* Aliases for SHA are SHA-1 and SHA1. |
|
43 |
* |
|
44 |
* - SHA1withDSA is the signature scheme described in FIPS 186. |
|
45 |
* (SHA used in DSA is SHA-1: FIPS 186 with Change No 1.) |
|
46 |
* Aliases for SHA1withDSA are DSA, DSS, SHA/DSA, SHA-1/DSA, SHA1/DSA, |
|
47 |
* SHAwithDSA, DSAWithSHA1, and the object |
|
48 |
* identifier strings "OID.1.3.14.3.2.13", "OID.1.3.14.3.2.27" and |
|
49 |
* "OID.1.2.840.10040.4.3". |
|
50 |
* |
|
12685 | 51 |
* - SHA-2 is a set of message digest schemes described in FIPS 180-2. |
52 |
* SHA-2 family of hash functions includes SHA-224, SHA-256, SHA-384, |
|
53 |
* and SHA-512. |
|
54 |
* |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
55 |
* - SHA-224withDSA/SHA-256withDSA are the signature schemes |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
56 |
* described in FIPS 186-3. The associated object identifiers are |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
57 |
* "OID.2.16.840.1.101.3.4.3.1", and "OID.2.16.840.1.101.3.4.3.2". |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
58 |
|
2 | 59 |
* - DSA is the key generation scheme as described in FIPS 186. |
60 |
* Aliases for DSA include the OID strings "OID.1.3.14.3.2.12" |
|
61 |
* and "OID.1.2.840.10040.4.1". |
|
62 |
* |
|
63 |
* - MD5 is the message digest scheme described in RFC 1321. |
|
64 |
* There are no aliases for MD5. |
|
65 |
* |
|
66 |
* - X.509 is the certificate factory type for X.509 certificates |
|
67 |
* and CRLs. Aliases for X.509 are X509. |
|
68 |
* |
|
69 |
* - PKIX is the certification path validation algorithm described |
|
26967
c182469301ee
8037550: Update RFC references in javadoc to RFC 5280
juh
parents:
25859
diff
changeset
|
70 |
* in RFC 5280. The ValidationAlgorithm attribute notes the |
2 | 71 |
* specification that this provider implements. |
72 |
* |
|
73 |
* - JavaPolicy is the default file-based Policy type. |
|
74 |
* |
|
75 |
* - JavaLoginConfig is the default file-based LoginModule Configuration type. |
|
76 |
*/ |
|
77 |
||
78 |
final class SunEntries { |
|
79 |
||
47421
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
80 |
private static final boolean useLegacyDSA = |
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
81 |
Boolean.parseBoolean(GetPropertyAction.privilegedGetProperty |
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
82 |
("jdk.security.legacyDSAKeyPairGenerator")); |
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
83 |
|
2 | 84 |
private SunEntries() { |
85 |
// empty |
|
86 |
} |
|
87 |
||
88 |
static void putEntries(Map<Object, Object> map) { |
|
89 |
||
90 |
/* |
|
91 |
* SecureRandom |
|
92 |
* |
|
93 |
* Register these first to speed up "new SecureRandom()", |
|
94 |
* which iterates through the list of algorithms |
|
95 |
*/ |
|
96 |
// register the native PRNG, if available |
|
97 |
// if user selected /dev/urandom, we put it before SHA1PRNG, |
|
98 |
// otherwise after it |
|
99 |
boolean nativeAvailable = NativePRNG.isAvailable(); |
|
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
100 |
boolean useNativePRNG = seedSource.equals(URL_DEV_URANDOM) || |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
101 |
seedSource.equals(URL_DEV_RANDOM); |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
102 |
|
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
103 |
if (nativeAvailable && useNativePRNG) { |
2 | 104 |
map.put("SecureRandom.NativePRNG", |
105 |
"sun.security.provider.NativePRNG"); |
|
42161
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
106 |
map.put("SecureRandom.NativePRNG ThreadSafe", "true"); |
2 | 107 |
} |
37796
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
108 |
|
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
109 |
map.put("SecureRandom.DRBG", "sun.security.provider.DRBG"); |
42161
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
110 |
map.put("SecureRandom.DRBG ThreadSafe", "true"); |
37796
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
111 |
|
2 | 112 |
map.put("SecureRandom.SHA1PRNG", |
113 |
"sun.security.provider.SecureRandom"); |
|
42161
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
114 |
|
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
115 |
map.put("SecureRandom.SHA1PRNG ThreadSafe", "true"); |
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
116 |
if (nativeAvailable && !useNativePRNG) { |
2 | 117 |
map.put("SecureRandom.NativePRNG", |
118 |
"sun.security.provider.NativePRNG"); |
|
42161
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
119 |
map.put("SecureRandom.NativePRNG ThreadSafe", "true"); |
2 | 120 |
} |
121 |
||
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
122 |
if (NativePRNG.Blocking.isAvailable()) { |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
123 |
map.put("SecureRandom.NativePRNGBlocking", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
124 |
"sun.security.provider.NativePRNG$Blocking"); |
42161
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
125 |
map.put("SecureRandom.NativePRNGBlocking ThreadSafe", "true"); |
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
126 |
} |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
127 |
|
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
128 |
if (NativePRNG.NonBlocking.isAvailable()) { |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
129 |
map.put("SecureRandom.NativePRNGNonBlocking", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
130 |
"sun.security.provider.NativePRNG$NonBlocking"); |
42161
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
131 |
map.put("SecureRandom.NativePRNGNonBlocking ThreadSafe", "true"); |
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
132 |
} |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
133 |
|
2 | 134 |
/* |
135 |
* Signature engines |
|
136 |
*/ |
|
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
137 |
map.put("Signature.SHA1withDSA", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
138 |
"sun.security.provider.DSA$SHA1withDSA"); |
2 | 139 |
map.put("Signature.NONEwithDSA", "sun.security.provider.DSA$RawDSA"); |
140 |
map.put("Alg.Alias.Signature.RawDSA", "NONEwithDSA"); |
|
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
141 |
map.put("Signature.SHA224withDSA", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
142 |
"sun.security.provider.DSA$SHA224withDSA"); |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
143 |
map.put("Signature.SHA256withDSA", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
144 |
"sun.security.provider.DSA$SHA256withDSA"); |
2 | 145 |
|
28974
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
146 |
map.put("Signature.SHA1withDSAinP1363Format", |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
147 |
"sun.security.provider.DSA$SHA1withDSAinP1363Format"); |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
148 |
map.put("Signature.NONEwithDSAinP1363Format", |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
149 |
"sun.security.provider.DSA$RawDSAinP1363Format"); |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
150 |
map.put("Signature.SHA224withDSAinP1363Format", |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
151 |
"sun.security.provider.DSA$SHA224withDSAinP1363Format"); |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
152 |
map.put("Signature.SHA256withDSAinP1363Format", |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
153 |
"sun.security.provider.DSA$SHA256withDSAinP1363Format"); |
71fe221460f5
8042967: Add variant of DSA Signature algorithms that do not ASN.1 encode the signature bytes
juh
parents:
28243
diff
changeset
|
154 |
|
2 | 155 |
String dsaKeyClasses = "java.security.interfaces.DSAPublicKey" + |
156 |
"|java.security.interfaces.DSAPrivateKey"; |
|
157 |
map.put("Signature.SHA1withDSA SupportedKeyClasses", dsaKeyClasses); |
|
158 |
map.put("Signature.NONEwithDSA SupportedKeyClasses", dsaKeyClasses); |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
159 |
map.put("Signature.SHA224withDSA SupportedKeyClasses", dsaKeyClasses); |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
160 |
map.put("Signature.SHA256withDSA SupportedKeyClasses", dsaKeyClasses); |
2 | 161 |
|
162 |
map.put("Alg.Alias.Signature.DSA", "SHA1withDSA"); |
|
163 |
map.put("Alg.Alias.Signature.DSS", "SHA1withDSA"); |
|
164 |
map.put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA"); |
|
165 |
map.put("Alg.Alias.Signature.SHA-1/DSA", "SHA1withDSA"); |
|
166 |
map.put("Alg.Alias.Signature.SHA1/DSA", "SHA1withDSA"); |
|
167 |
map.put("Alg.Alias.Signature.SHAwithDSA", "SHA1withDSA"); |
|
168 |
map.put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA"); |
|
169 |
map.put("Alg.Alias.Signature.OID.1.2.840.10040.4.3", |
|
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
170 |
"SHA1withDSA"); |
2 | 171 |
map.put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA"); |
172 |
map.put("Alg.Alias.Signature.1.3.14.3.2.13", "SHA1withDSA"); |
|
173 |
map.put("Alg.Alias.Signature.1.3.14.3.2.27", "SHA1withDSA"); |
|
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
174 |
map.put("Alg.Alias.Signature.OID.2.16.840.1.101.3.4.3.1", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
175 |
"SHA224withDSA"); |
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
176 |
map.put("Alg.Alias.Signature.2.16.840.1.101.3.4.3.1", "SHA224withDSA"); |
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
177 |
map.put("Alg.Alias.Signature.OID.2.16.840.1.101.3.4.3.2", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
178 |
"SHA256withDSA"); |
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
179 |
map.put("Alg.Alias.Signature.2.16.840.1.101.3.4.3.2", "SHA256withDSA"); |
2 | 180 |
|
181 |
/* |
|
182 |
* Key Pair Generator engines |
|
183 |
*/ |
|
47421
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
184 |
String dsaKPGImplClass = "sun.security.provider.DSAKeyPairGenerator$"; |
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
185 |
dsaKPGImplClass += (useLegacyDSA? "Legacy" : "Current"); |
f9e03aef3a49
8181048: Refactor existing providers to refer to the same constants for default values for key length
valeriep
parents:
47216
diff
changeset
|
186 |
map.put("KeyPairGenerator.DSA", dsaKPGImplClass); |
2 | 187 |
map.put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA"); |
188 |
map.put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA"); |
|
189 |
map.put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA"); |
|
190 |
||
191 |
/* |
|
192 |
* Digest engines |
|
193 |
*/ |
|
194 |
map.put("MessageDigest.MD2", "sun.security.provider.MD2"); |
|
195 |
map.put("MessageDigest.MD5", "sun.security.provider.MD5"); |
|
196 |
map.put("MessageDigest.SHA", "sun.security.provider.SHA"); |
|
197 |
||
198 |
map.put("Alg.Alias.MessageDigest.SHA-1", "SHA"); |
|
199 |
map.put("Alg.Alias.MessageDigest.SHA1", "SHA"); |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
200 |
map.put("Alg.Alias.MessageDigest.1.3.14.3.2.26", "SHA"); |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
201 |
map.put("Alg.Alias.MessageDigest.OID.1.3.14.3.2.26", "SHA"); |
2 | 202 |
|
12685 | 203 |
map.put("MessageDigest.SHA-224", "sun.security.provider.SHA2$SHA224"); |
204 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.4", "SHA-224"); |
|
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
205 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.4", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
206 |
"SHA-224"); |
12685 | 207 |
|
208 |
map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2$SHA256"); |
|
209 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.1", "SHA-256"); |
|
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
210 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.1", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
211 |
"SHA-256"); |
2 | 212 |
map.put("MessageDigest.SHA-384", "sun.security.provider.SHA5$SHA384"); |
12685 | 213 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.2", "SHA-384"); |
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
214 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.2", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
215 |
"SHA-384"); |
2 | 216 |
map.put("MessageDigest.SHA-512", "sun.security.provider.SHA5$SHA512"); |
12685 | 217 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.3", "SHA-512"); |
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
218 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.3", |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
219 |
"SHA-512"); |
37796
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
220 |
map.put("MessageDigest.SHA-512/224", "sun.security.provider.SHA5$SHA512_224"); |
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
221 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.5", "SHA-512/224"); |
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
222 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.5", |
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
223 |
"SHA-512/224"); |
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
224 |
map.put("MessageDigest.SHA-512/256", "sun.security.provider.SHA5$SHA512_256"); |
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
225 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.6", "SHA-512/256"); |
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
226 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.6", |
256c45c4af5d
8051408: NIST SP 800-90A SecureRandom implementations
weijun
parents:
32649
diff
changeset
|
227 |
"SHA-512/256"); |
2 | 228 |
|
37909 | 229 |
map.put("MessageDigest.SHA3-224", "sun.security.provider.SHA3$SHA224"); |
230 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.7", "SHA3-224"); |
|
231 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.7", |
|
232 |
"SHA3-224"); |
|
233 |
||
234 |
map.put("MessageDigest.SHA3-256", "sun.security.provider.SHA3$SHA256"); |
|
235 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.8", "SHA3-256"); |
|
236 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.8", |
|
237 |
"SHA3-256"); |
|
238 |
map.put("MessageDigest.SHA3-384", "sun.security.provider.SHA3$SHA384"); |
|
239 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.9", "SHA3-384"); |
|
240 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.9", |
|
241 |
"SHA3-384"); |
|
242 |
map.put("MessageDigest.SHA3-512", "sun.security.provider.SHA3$SHA512"); |
|
243 |
map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.10", "SHA3-512"); |
|
244 |
map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.10", |
|
245 |
"SHA3-512"); |
|
246 |
||
247 |
||
2 | 248 |
/* |
249 |
* Algorithm Parameter Generator engines |
|
250 |
*/ |
|
251 |
map.put("AlgorithmParameterGenerator.DSA", |
|
252 |
"sun.security.provider.DSAParameterGenerator"); |
|
253 |
||
254 |
/* |
|
255 |
* Algorithm Parameter engines |
|
256 |
*/ |
|
257 |
map.put("AlgorithmParameters.DSA", |
|
258 |
"sun.security.provider.DSAParameters"); |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
259 |
map.put("Alg.Alias.AlgorithmParameters.OID.1.2.840.10040.4.1", "DSA"); |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
260 |
map.put("Alg.Alias.AlgorithmParameters.1.2.840.10040.4.1", "DSA"); |
2 | 261 |
map.put("Alg.Alias.AlgorithmParameters.1.3.14.3.2.12", "DSA"); |
262 |
||
263 |
/* |
|
264 |
* Key factories |
|
265 |
*/ |
|
266 |
map.put("KeyFactory.DSA", "sun.security.provider.DSAKeyFactory"); |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
267 |
map.put("Alg.Alias.KeyFactory.OID.1.2.840.10040.4.1", "DSA"); |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
268 |
map.put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA"); |
2 | 269 |
map.put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA"); |
270 |
||
271 |
/* |
|
272 |
* Certificates |
|
273 |
*/ |
|
274 |
map.put("CertificateFactory.X.509", |
|
275 |
"sun.security.provider.X509Factory"); |
|
276 |
map.put("Alg.Alias.CertificateFactory.X509", "X.509"); |
|
277 |
||
278 |
/* |
|
279 |
* KeyStore |
|
280 |
*/ |
|
28243
47080f9ae750
8044445: JEP 229: Create PKCS12 Keystores by Default
vinnie
parents:
26967
diff
changeset
|
281 |
map.put("KeyStore.PKCS12", |
47080f9ae750
8044445: JEP 229: Create PKCS12 Keystores by Default
vinnie
parents:
26967
diff
changeset
|
282 |
"sun.security.pkcs12.PKCS12KeyStore$DualFormatPKCS12"); |
47080f9ae750
8044445: JEP 229: Create PKCS12 Keystores by Default
vinnie
parents:
26967
diff
changeset
|
283 |
map.put("KeyStore.JKS", |
47080f9ae750
8044445: JEP 229: Create PKCS12 Keystores by Default
vinnie
parents:
26967
diff
changeset
|
284 |
"sun.security.provider.JavaKeyStore$DualFormatJKS"); |
2 | 285 |
map.put("KeyStore.CaseExactJKS", |
286 |
"sun.security.provider.JavaKeyStore$CaseExactJKS"); |
|
15664
e33b115f1981
8007755: Support the logical grouping of keystores
vinnie
parents:
13672
diff
changeset
|
287 |
map.put("KeyStore.DKS", "sun.security.provider.DomainKeyStore$DKS"); |
2 | 288 |
|
289 |
/* |
|
290 |
* Policy |
|
291 |
*/ |
|
292 |
map.put("Policy.JavaPolicy", "sun.security.provider.PolicySpiFile"); |
|
293 |
||
294 |
/* |
|
295 |
* Configuration |
|
296 |
*/ |
|
297 |
map.put("Configuration.JavaLoginConfig", |
|
19385
a7b34a4b1fcb
8016848: javax_security/auth/login tests fail in compact 1 and 2 profiles
mullan
parents:
16915
diff
changeset
|
298 |
"sun.security.provider.ConfigFile$Spi"); |
2 | 299 |
|
300 |
/* |
|
301 |
* CertPathBuilder |
|
302 |
*/ |
|
303 |
map.put("CertPathBuilder.PKIX", |
|
304 |
"sun.security.provider.certpath.SunCertPathBuilder"); |
|
305 |
map.put("CertPathBuilder.PKIX ValidationAlgorithm", |
|
26967
c182469301ee
8037550: Update RFC references in javadoc to RFC 5280
juh
parents:
25859
diff
changeset
|
306 |
"RFC5280"); |
2 | 307 |
|
308 |
/* |
|
309 |
* CertPathValidator |
|
310 |
*/ |
|
311 |
map.put("CertPathValidator.PKIX", |
|
312 |
"sun.security.provider.certpath.PKIXCertPathValidator"); |
|
313 |
map.put("CertPathValidator.PKIX ValidationAlgorithm", |
|
26967
c182469301ee
8037550: Update RFC references in javadoc to RFC 5280
juh
parents:
25859
diff
changeset
|
314 |
"RFC5280"); |
2 | 315 |
|
316 |
/* |
|
317 |
* CertStores |
|
318 |
*/ |
|
319 |
map.put("CertStore.Collection", |
|
320 |
"sun.security.provider.certpath.CollectionCertStore"); |
|
321 |
map.put("CertStore.com.sun.security.IndexedCollection", |
|
322 |
"sun.security.provider.certpath.IndexedCollectionCertStore"); |
|
323 |
||
324 |
/* |
|
325 |
* KeySize |
|
326 |
*/ |
|
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
327 |
map.put("Signature.NONEwithDSA KeySize", "1024"); |
2 | 328 |
map.put("Signature.SHA1withDSA KeySize", "1024"); |
13672
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
329 |
map.put("Signature.SHA224withDSA KeySize", "2048"); |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
330 |
map.put("Signature.SHA256withDSA KeySize", "2048"); |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
331 |
|
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
332 |
map.put("KeyPairGenerator.DSA KeySize", "2048"); |
604588823b5a
7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
12685
diff
changeset
|
333 |
map.put("AlgorithmParameterGenerator.DSA KeySize", "2048"); |
2 | 334 |
|
335 |
/* |
|
336 |
* Implementation type: software or hardware |
|
337 |
*/ |
|
338 |
map.put("Signature.SHA1withDSA ImplementedIn", "Software"); |
|
339 |
map.put("KeyPairGenerator.DSA ImplementedIn", "Software"); |
|
340 |
map.put("MessageDigest.MD5 ImplementedIn", "Software"); |
|
341 |
map.put("MessageDigest.SHA ImplementedIn", "Software"); |
|
342 |
map.put("AlgorithmParameterGenerator.DSA ImplementedIn", |
|
343 |
"Software"); |
|
344 |
map.put("AlgorithmParameters.DSA ImplementedIn", "Software"); |
|
345 |
map.put("KeyFactory.DSA ImplementedIn", "Software"); |
|
346 |
map.put("SecureRandom.SHA1PRNG ImplementedIn", "Software"); |
|
42161
5b0b84715c06
7004967: SecureRandom should be more explicit about threading
weijun
parents:
37909
diff
changeset
|
347 |
map.put("SecureRandom.DRBG ImplementedIn", "Software"); |
2 | 348 |
map.put("CertificateFactory.X.509 ImplementedIn", "Software"); |
349 |
map.put("KeyStore.JKS ImplementedIn", "Software"); |
|
350 |
map.put("CertPathValidator.PKIX ImplementedIn", "Software"); |
|
351 |
map.put("CertPathBuilder.PKIX ImplementedIn", "Software"); |
|
352 |
map.put("CertStore.Collection ImplementedIn", "Software"); |
|
353 |
map.put("CertStore.com.sun.security.IndexedCollection ImplementedIn", |
|
354 |
"Software"); |
|
355 |
||
356 |
} |
|
357 |
||
358 |
// name of the *System* property, takes precedence over PROP_RNDSOURCE |
|
32649
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
30506
diff
changeset
|
359 |
private static final String PROP_EGD = "java.security.egd"; |
2 | 360 |
// name of the *Security* property |
32649
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
30506
diff
changeset
|
361 |
private static final String PROP_RNDSOURCE = "securerandom.source"; |
2 | 362 |
|
32649
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
30506
diff
changeset
|
363 |
static final String URL_DEV_RANDOM = "file:/dev/random"; |
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
30506
diff
changeset
|
364 |
static final String URL_DEV_URANDOM = "file:/dev/urandom"; |
2 | 365 |
|
366 |
private static final String seedSource; |
|
367 |
||
368 |
static { |
|
369 |
seedSource = AccessController.doPrivileged( |
|
370 |
new PrivilegedAction<String>() { |
|
371 |
||
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
372 |
@Override |
2 | 373 |
public String run() { |
374 |
String egdSource = System.getProperty(PROP_EGD, ""); |
|
375 |
if (egdSource.length() != 0) { |
|
376 |
return egdSource; |
|
377 |
} |
|
378 |
egdSource = Security.getProperty(PROP_RNDSOURCE); |
|
379 |
if (egdSource == null) { |
|
380 |
return ""; |
|
381 |
} |
|
382 |
return egdSource; |
|
383 |
} |
|
384 |
}); |
|
385 |
} |
|
386 |
||
387 |
static String getSeedSource() { |
|
388 |
return seedSource; |
|
389 |
} |
|
390 |
||
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
391 |
/* |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
392 |
* Use a URI to access this File. Previous code used a URL |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
393 |
* which is less strict on syntax. If we encounter a |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
394 |
* URISyntaxException we make best efforts for backwards |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
395 |
* compatibility. e.g. space character in deviceName string. |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
396 |
* |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
397 |
* Method called within PrivilegedExceptionAction block. |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
398 |
* |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
399 |
* Moved from SeedGenerator to avoid initialization problems with |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
400 |
* signed providers. |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
401 |
*/ |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
402 |
static File getDeviceFile(URL device) throws IOException { |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
403 |
try { |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
404 |
URI deviceURI = device.toURI(); |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
405 |
if(deviceURI.isOpaque()) { |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
406 |
// File constructor does not accept opaque URI |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
407 |
URI localDir = new File( |
50817
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47421
diff
changeset
|
408 |
StaticProperty.userDir()).toURI(); |
16915
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
409 |
String uriPath = localDir.toString() + |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
410 |
deviceURI.toString().substring(5); |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
411 |
return new File(URI.create(uriPath)); |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
412 |
} else { |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
413 |
return new File(deviceURI); |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
414 |
} |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
415 |
} catch (URISyntaxException use) { |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
416 |
/* |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
417 |
* Make best effort to access this File. |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
418 |
* We can try using the URL path. |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
419 |
*/ |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
420 |
return new File(device.getPath()); |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
421 |
} |
675d1569af3e
6425477: Better support for generation of high entropy random numbers
wetmore
parents:
15664
diff
changeset
|
422 |
} |
2 | 423 |
} |