src/java.base/share/classes/sun/security/provider/SunEntries.java
author weijun
Wed, 01 Aug 2018 13:35:08 +0800
changeset 51272 9d92ff04a29c
parent 50817 fa1e04811ff6
child 52995 9af672cab7cb
permissions -rw-r--r--
8208602: Cannot read PEM X.509 cert if there is whitespace after the header or footer Reviewed-by: xuelei
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4039
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4039
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4039
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4039
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4039
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.security.provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * Defines the entries of the SUN provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * Algorithms supported, and their names:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * - SHA is the message digest scheme described in FIPS 180-1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *   Aliases for SHA are SHA-1 and SHA1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * - SHA1withDSA is the signature scheme described in FIPS 186.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *   (SHA used in DSA is SHA-1: FIPS 186 with Change No 1.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *   Aliases for SHA1withDSA are DSA, DSS, SHA/DSA, SHA-1/DSA, SHA1/DSA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *   SHAwithDSA, DSAWithSHA1, and the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *   identifier strings "OID.1.3.14.3.2.13", "OID.1.3.14.3.2.27" and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *   "OID.1.2.840.10040.4.3".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
12685
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
    51
 * - SHA-2 is a set of message digest schemes described in FIPS 180-2.
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
    52
 *   SHA-2 family of hash functions includes SHA-224, SHA-256, SHA-384,
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
    53
 *   and SHA-512.
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * - DSA is the key generation scheme as described in FIPS 186.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *   Aliases for DSA include the OID strings "OID.1.3.14.3.2.12"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *   and "OID.1.2.840.10040.4.1".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * - MD5 is the message digest scheme described in RFC 1321.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *   There are no aliases for MD5.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * - X.509 is the certificate factory type for X.509 certificates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *   and CRLs. Aliases for X.509 are X509.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *   specification that this provider implements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * - JavaPolicy is the default file-based Policy type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * - JavaLoginConfig is the default file-based LoginModule Configuration type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
final class SunEntries {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    private SunEntries() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        // empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    static void putEntries(Map<Object, Object> map) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
         * SecureRandom
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
         * Register these first to speed up "new SecureRandom()",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
         * which iterates through the list of algorithms
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        // register the native PRNG, if available
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        // if user selected /dev/urandom, we put it before SHA1PRNG,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        // otherwise after it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            map.put("SecureRandom.NativePRNG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        map.put("SecureRandom.SHA1PRNG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            map.put("SecureRandom.NativePRNG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
         * Signature engines
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        map.put("Signature.NONEwithDSA", "sun.security.provider.DSA$RawDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        String dsaKeyClasses = "java.security.interfaces.DSAPublicKey" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                "|java.security.interfaces.DSAPrivateKey";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        map.put("Signature.SHA1withDSA SupportedKeyClasses", dsaKeyClasses);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        map.put("Alg.Alias.Signature.DSA", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        map.put("Alg.Alias.Signature.DSS", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        map.put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        map.put("Alg.Alias.Signature.SHA-1/DSA", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        map.put("Alg.Alias.Signature.SHA1/DSA", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        map.put("Alg.Alias.Signature.SHAwithDSA", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        map.put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        map.put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        map.put("Alg.Alias.Signature.1.3.14.3.2.13", "SHA1withDSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
         *  Key Pair Generator engines
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        map.put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        map.put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        map.put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
         * Digest engines
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        map.put("MessageDigest.MD2", "sun.security.provider.MD2");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        map.put("MessageDigest.MD5", "sun.security.provider.MD5");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        map.put("MessageDigest.SHA", "sun.security.provider.SHA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        map.put("Alg.Alias.MessageDigest.SHA-1", "SHA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
12685
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
   203
        map.put("MessageDigest.SHA-224", "sun.security.provider.SHA2$SHA224");
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
   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
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
   207
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
   208
        map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2$SHA256");
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        map.put("MessageDigest.SHA-384", "sun.security.provider.SHA5$SHA384");
12685
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        map.put("MessageDigest.SHA-512", "sun.security.provider.SHA5$SHA512");
12685
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 5506
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
37909
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   229
        map.put("MessageDigest.SHA3-224", "sun.security.provider.SHA3$SHA224");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   230
        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.7", "SHA3-224");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   231
        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.7",
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   232
                "SHA3-224");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   233
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   234
        map.put("MessageDigest.SHA3-256", "sun.security.provider.SHA3$SHA256");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   235
        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.8", "SHA3-256");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   236
        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.8",
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   237
                "SHA3-256");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   238
        map.put("MessageDigest.SHA3-384", "sun.security.provider.SHA3$SHA384");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   239
        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.9", "SHA3-384");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   240
        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.9",
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   241
                "SHA3-384");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   242
        map.put("MessageDigest.SHA3-512", "sun.security.provider.SHA3$SHA512");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   243
        map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.10", "SHA3-512");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   244
        map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.10",
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   245
                "SHA3-512");
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   246
38b1efe33344 8000415: Add support for SHA-3
valeriep
parents: 37796
diff changeset
   247
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
         * Algorithm Parameter Generator engines
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        map.put("AlgorithmParameterGenerator.DSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            "sun.security.provider.DSAParameterGenerator");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
         * Algorithm Parameter engines
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        map.put("AlgorithmParameters.DSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        map.put("Alg.Alias.AlgorithmParameters.1.3.14.3.2.12", "DSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
         * Key factories
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        map.put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
         * Certificates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        map.put("CertificateFactory.X.509",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            "sun.security.provider.X509Factory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        map.put("Alg.Alias.CertificateFactory.X509", "X.509");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
         * KeyStore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        map.put("KeyStore.CaseExactJKS",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
         * Policy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        map.put("Policy.JavaPolicy", "sun.security.provider.PolicySpiFile");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
         * Configuration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
         * CertPathBuilder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        map.put("CertPathBuilder.PKIX",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            "sun.security.provider.certpath.SunCertPathBuilder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
         * CertPathValidator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        map.put("CertPathValidator.PKIX",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            "sun.security.provider.certpath.PKIXCertPathValidator");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
         * CertStores
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        map.put("CertStore.Collection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            "sun.security.provider.certpath.CollectionCertStore");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        map.put("CertStore.com.sun.security.IndexedCollection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            "sun.security.provider.certpath.IndexedCollectionCertStore");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
         * KeySize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
         * Implementation type: software or hardware
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        map.put("Signature.SHA1withDSA ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        map.put("KeyPairGenerator.DSA ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        map.put("MessageDigest.MD5 ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        map.put("MessageDigest.SHA ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        map.put("AlgorithmParameterGenerator.DSA ImplementedIn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        map.put("AlgorithmParameters.DSA ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        map.put("KeyFactory.DSA ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        map.put("CertificateFactory.X.509 ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        map.put("KeyStore.JKS ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        map.put("CertPathValidator.PKIX ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        map.put("CertPathBuilder.PKIX ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        map.put("CertStore.Collection ImplementedIn", "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        map.put("CertStore.com.sun.security.IndexedCollection ImplementedIn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            "Software");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    private static final String seedSource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        seedSource = AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                new PrivilegedAction<String>() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
16915
675d1569af3e 6425477: Better support for generation of high entropy random numbers
wetmore
parents: 15664
diff changeset
   372
            @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            public String run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                String egdSource = System.getProperty(PROP_EGD, "");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                if (egdSource.length() != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                    return egdSource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                egdSource = Security.getProperty(PROP_RNDSOURCE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                if (egdSource == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                    return "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
                return egdSource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    static String getSeedSource() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        return seedSource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
}