jdk/src/java.base/share/classes/sun/security/ssl/SunJSSE.java
author rriggs
Wed, 05 Apr 2017 09:57:32 -0400
changeset 44534 a076dffbc2c1
parent 40416 5d91b2fd668c
permissions -rw-r--r--
8165641: Deprecate Object.finalize Reviewed-by: mchung, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
44534
a076dffbc2c1 8165641: Deprecate Object.finalize
rriggs
parents: 40416
diff changeset
     2
 * Copyright (c) 1999, 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: 3618
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: 3618
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: 3618
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3618
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3618
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package sun.security.ssl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.security.*;
40416
5d91b2fd668c 8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents: 39562
diff changeset
    30
import static sun.security.util.SecurityConstants.PROVIDER_VER;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * The JSSE provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * The RSA implementation has been removed from JSSE, but we still need to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * register the same algorithms for compatibility. We just point to the RSA
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * implementation in the SunRsaSign provider. This works because all classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * are in the bootclasspath and therefore loaded by the same classloader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * SunJSSE now supports an experimental FIPS compliant mode when used with an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * appropriate FIPS certified crypto provider. In FIPS mode, we:
7039
6464c8e62a18 4873188: Support TLS 1.1
xuelei
parents: 5506
diff changeset
    42
 *  . allow only TLS 1.0 or later
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *  . allow only FIPS approved ciphersuites
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *  . perform all crypto in the FIPS crypto provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * It is currently not possible to use both FIPS compliant SunJSSE and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * standard JSSE at the same time because of the various static data structures
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * we use.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * However, we do want to allow FIPS mode to be enabled at runtime and without
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * editing the java.security file. That means we need to allow
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * Security.removeProvider("SunJSSE") to work, which creates an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * this class in non-FIPS mode. That is why we delay the selection of the mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * as long as possible. This is until we open an SSL/TLS connection and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * data structures need to be initialized or until SunJSSE is initialized in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * FIPS mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
public abstract class SunJSSE extends java.security.Provider {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private static final long serialVersionUID = 3231825739635378733L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private static String info = "Sun JSSE provider" +
22068
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
    64
        "(PKCS12, SunX509/PKIX key/trust factories, " +
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
    65
        "SSLv3/TLSv1/TLSv1.1/TLSv1.2/DTLSv1.0/DTLSv1.2)";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private static String fipsInfo =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        "Sun JSSE provider (FIPS mode, crypto provider ";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    // tri-valued flag:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    // null  := no final decision made
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    // false := data structures initialized in non-FIPS mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    // true  := data structures initialized in FIPS mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static Boolean fips;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    // the FIPS certificate crypto provider that we use to perform all crypto
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    // operations. null in non-FIPS mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    static java.security.Provider cryptoProvider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    protected static synchronized boolean isFIPS() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        if (fips == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            fips = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        return fips;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    // ensure we can use FIPS mode using the specified crypto provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    // enable FIPS mode if not already enabled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    private static synchronized void ensureFIPS(java.security.Provider p) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        if (fips == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            fips = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            cryptoProvider = p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            if (fips == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                throw new ProviderException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                    ("SunJSSE already initialized in non-FIPS mode");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            if (cryptoProvider != p) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                throw new ProviderException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                    ("SunJSSE already initialized with FIPS crypto provider "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                    + cryptoProvider);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    // standard constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    protected SunJSSE() {
40416
5d91b2fd668c 8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents: 39562
diff changeset
   108
        super("SunJSSE", PROVIDER_VER, info);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        subclassCheck();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        if (Boolean.TRUE.equals(fips)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            throw new ProviderException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                ("SunJSSE is already initialized in FIPS mode");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        registerAlgorithms(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20485
diff changeset
   117
    // preferred constructor to enable FIPS mode at runtime
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    protected SunJSSE(java.security.Provider cryptoProvider){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        this(checkNull(cryptoProvider), cryptoProvider.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    // constructor to enable FIPS mode from java.security file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    protected SunJSSE(String cryptoProvider){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        this(null, checkNull(cryptoProvider));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    private static <T> T checkNull(T t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        if (t == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            throw new ProviderException("cryptoProvider must not be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        return t;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
7043
5e2d1edeb2c7 6916074: Add support for TLS 1.2
xuelei
parents: 7039
diff changeset
   134
    private SunJSSE(java.security.Provider cryptoProvider,
5e2d1edeb2c7 6916074: Add support for TLS 1.2
xuelei
parents: 7039
diff changeset
   135
            String providerName) {
40416
5d91b2fd668c 8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents: 39562
diff changeset
   136
        super("SunJSSE", PROVIDER_VER, fipsInfo + providerName + ")");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        subclassCheck();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        if (cryptoProvider == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            // Calling Security.getProvider() will cause other providers to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            // loaded. That is not good but unavoidable here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            cryptoProvider = Security.getProvider(providerName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            if (cryptoProvider == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                throw new ProviderException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                    ("Crypto provider not installed: " + providerName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        ensureFIPS(cryptoProvider);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        registerAlgorithms(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    private void registerAlgorithms(final boolean isfips) {
30033
b9c86c17164a 8078468: Update security libraries to use diamond with anonymous classes
darcy
parents: 25859
diff changeset
   152
        AccessController.doPrivileged(new PrivilegedAction<>() {
14664
e71aa0962e70 8003950: Adds missing Override annotations and removes unnecessary imports in sun.security.ssl
xuelei
parents: 14194
diff changeset
   153
            @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                doRegister(isfips);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    private void doRegister(boolean isfips) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        if (isfips == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            put("KeyFactory.RSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                "sun.security.rsa.RSAKeyFactory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            put("Alg.Alias.KeyFactory.1.2.840.113549.1.1", "RSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            put("Alg.Alias.KeyFactory.OID.1.2.840.113549.1.1", "RSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            put("KeyPairGenerator.RSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                "sun.security.rsa.RSAKeyPairGenerator");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1", "RSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            put("Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.1", "RSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            put("Signature.MD2withRSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                "sun.security.rsa.RSASignature$MD2withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            put("Alg.Alias.Signature.1.2.840.113549.1.1.2", "MD2withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.2",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                "MD2withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            put("Signature.MD5withRSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                "sun.security.rsa.RSASignature$MD5withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            put("Alg.Alias.Signature.1.2.840.113549.1.1.4", "MD5withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.4",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                "MD5withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            put("Signature.SHA1withRSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                "sun.security.rsa.RSASignature$SHA1withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            put("Alg.Alias.Signature.1.2.840.113549.1.1.5", "SHA1withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.5",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                "SHA1withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            put("Alg.Alias.Signature.1.3.14.3.2.29", "SHA1withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            put("Alg.Alias.Signature.OID.1.3.14.3.2.29", "SHA1withRSA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        put("Signature.MD5andSHA1withRSA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            "sun.security.ssl.RSASignature");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        put("KeyManagerFactory.SunX509",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            "sun.security.ssl.KeyManagerFactoryImpl$SunX509");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        put("KeyManagerFactory.NewSunX509",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            "sun.security.ssl.KeyManagerFactoryImpl$X509");
8791
f5106bbf577d 7022855: Export "PKIX" as the standard algorithm name of KeyManagerFactory
xuelei
parents: 7043
diff changeset
   201
        put("Alg.Alias.KeyManagerFactory.PKIX", "NewSunX509");
f5106bbf577d 7022855: Export "PKIX" as the standard algorithm name of KeyManagerFactory
xuelei
parents: 7043
diff changeset
   202
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        put("TrustManagerFactory.SunX509",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            "sun.security.ssl.TrustManagerFactoryImpl$SimpleFactory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        put("TrustManagerFactory.PKIX",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            "sun.security.ssl.TrustManagerFactoryImpl$PKIXFactory");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        put("Alg.Alias.TrustManagerFactory.SunPKIX", "PKIX");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        put("Alg.Alias.TrustManagerFactory.X509", "PKIX");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        put("Alg.Alias.TrustManagerFactory.X.509", "PKIX");
9246
c459f79af46b 6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents: 8791
diff changeset
   210
c459f79af46b 6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents: 8791
diff changeset
   211
        put("SSLContext.TLSv1",
c459f79af46b 6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents: 8791
diff changeset
   212
            "sun.security.ssl.SSLContextImpl$TLS10Context");
7039
6464c8e62a18 4873188: Support TLS 1.1
xuelei
parents: 5506
diff changeset
   213
        put("SSLContext.TLSv1.1",
9246
c459f79af46b 6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents: 8791
diff changeset
   214
            "sun.security.ssl.SSLContextImpl$TLS11Context");
7043
5e2d1edeb2c7 6916074: Add support for TLS 1.2
xuelei
parents: 7039
diff changeset
   215
        put("SSLContext.TLSv1.2",
9246
c459f79af46b 6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents: 8791
diff changeset
   216
            "sun.security.ssl.SSLContextImpl$TLS12Context");
22068
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
   217
        put("SSLContext.TLS",
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
   218
            "sun.security.ssl.SSLContextImpl$TLSContext");
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
   219
        if (isfips == false) {
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
   220
            put("Alg.Alias.SSLContext.SSL", "TLS");
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
   221
            put("Alg.Alias.SSLContext.SSLv3", "TLSv1");
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
   222
        }
95a7a3cd72a0 7093640: Enable client-side TLS 1.2 by default
xuelei
parents: 21278
diff changeset
   223
30904
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
   224
        put("SSLContext.DTLSv1.0",
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
   225
            "sun.security.ssl.SSLContextImpl$DTLS10Context");
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
   226
        put("SSLContext.DTLSv1.2",
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
   227
            "sun.security.ssl.SSLContextImpl$DTLS12Context");
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
   228
        put("SSLContext.DTLS",
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
   229
            "sun.security.ssl.SSLContextImpl$DTLSContext");
ec0224270f90 8043758: Datagram Transport Layer Security (DTLS)
xuelei
parents: 30033
diff changeset
   230
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        put("SSLContext.Default",
9246
c459f79af46b 6976117: SSLContext.getInstance("TLSv1.1") returns SSLEngines/SSLSockets without TLSv1.1 enabled
xuelei
parents: 8791
diff changeset
   232
            "sun.security.ssl.SSLContextImpl$DefaultSSLContext");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
         * KeyStore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        put("KeyStore.PKCS12",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            "sun.security.pkcs12.PKCS12KeyStore");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
39562
672b948cb355 8157712: Deprecate the javax.security.cert and com.sun.net.ssl APIs with forRemoval=true
xuelei
parents: 33991
diff changeset
   241
    // com.sun.net.ssl.internal.ssl.Provider has been deprecated since JDK 9
672b948cb355 8157712: Deprecate the javax.security.cert and com.sun.net.ssl APIs with forRemoval=true
xuelei
parents: 33991
diff changeset
   242
    @SuppressWarnings("deprecation")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    private void subclassCheck() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        if (getClass() != com.sun.net.ssl.internal.ssl.Provider.class) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            throw new AssertionError("Illegal subclass: " + getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    @Override
44534
a076dffbc2c1 8165641: Deprecate Object.finalize
rriggs
parents: 40416
diff changeset
   250
    @SuppressWarnings("deprecation")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    protected final void finalize() throws Throwable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        // empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        super.finalize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}