src/java.base/share/classes/sun/security/ssl/SunJSSE.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
child 56592 b1902b22005e
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    20  *
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
       
    26 
    25 
    27 package sun.security.ssl;
    26 package sun.security.ssl;
    28 
    27 
    29 import java.security.*;
    28 import java.security.*;
    30 import static sun.security.util.SecurityConstants.PROVIDER_VER;
    29 import static sun.security.util.SecurityConstants.PROVIDER_VER;
    60 
    59 
    61     private static final long serialVersionUID = 3231825739635378733L;
    60     private static final long serialVersionUID = 3231825739635378733L;
    62 
    61 
    63     private static String info = "Sun JSSE provider" +
    62     private static String info = "Sun JSSE provider" +
    64         "(PKCS12, SunX509/PKIX key/trust factories, " +
    63         "(PKCS12, SunX509/PKIX key/trust factories, " +
    65         "SSLv3/TLSv1/TLSv1.1/TLSv1.2/DTLSv1.0/DTLSv1.2)";
    64         "SSLv3/TLSv1/TLSv1.1/TLSv1.2/TLSv1.3/DTLSv1.0/DTLSv1.2)";
    66 
    65 
    67     private static String fipsInfo =
    66     private static String fipsInfo =
    68         "Sun JSSE provider (FIPS mode, crypto provider ";
    67         "Sun JSSE provider (FIPS mode, crypto provider ";
    69 
    68 
    70     // tri-valued flag:
    69     // tri-valued flag:
   147         ensureFIPS(cryptoProvider);
   146         ensureFIPS(cryptoProvider);
   148         registerAlgorithms(true);
   147         registerAlgorithms(true);
   149     }
   148     }
   150 
   149 
   151     private void registerAlgorithms(final boolean isfips) {
   150     private void registerAlgorithms(final boolean isfips) {
   152         AccessController.doPrivileged(new PrivilegedAction<>() {
   151         AccessController.doPrivileged(new PrivilegedAction<Object>() {
   153             @Override
   152             @Override
   154             public Object run() {
   153             public Object run() {
   155                 doRegister(isfips);
   154                 doRegister(isfips);
   156                 return null;
   155                 return null;
   157             }
   156             }
   159     }
   158     }
   160 
   159 
   161     private void doRegister(boolean isfips) {
   160     private void doRegister(boolean isfips) {
   162         if (isfips == false) {
   161         if (isfips == false) {
   163             put("KeyFactory.RSA",
   162             put("KeyFactory.RSA",
   164                 "sun.security.rsa.RSAKeyFactory");
   163                 "sun.security.rsa.RSAKeyFactory$Legacy");
   165             put("Alg.Alias.KeyFactory.1.2.840.113549.1.1", "RSA");
   164             put("Alg.Alias.KeyFactory.1.2.840.113549.1.1", "RSA");
   166             put("Alg.Alias.KeyFactory.OID.1.2.840.113549.1.1", "RSA");
   165             put("Alg.Alias.KeyFactory.OID.1.2.840.113549.1.1", "RSA");
   167 
   166 
   168             put("KeyPairGenerator.RSA",
   167             put("KeyPairGenerator.RSA",
   169                 "sun.security.rsa.RSAKeyPairGenerator");
   168                 "sun.security.rsa.RSAKeyPairGenerator$Legacy");
   170             put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1", "RSA");
   169             put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1", "RSA");
   171             put("Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.1", "RSA");
   170             put("Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.1", "RSA");
   172 
   171 
   173             put("Signature.MD2withRSA",
   172             put("Signature.MD2withRSA",
   174                 "sun.security.rsa.RSASignature$MD2withRSA");
   173                 "sun.security.rsa.RSASignature$MD2withRSA");
   212             "sun.security.ssl.SSLContextImpl$TLS10Context");
   211             "sun.security.ssl.SSLContextImpl$TLS10Context");
   213         put("SSLContext.TLSv1.1",
   212         put("SSLContext.TLSv1.1",
   214             "sun.security.ssl.SSLContextImpl$TLS11Context");
   213             "sun.security.ssl.SSLContextImpl$TLS11Context");
   215         put("SSLContext.TLSv1.2",
   214         put("SSLContext.TLSv1.2",
   216             "sun.security.ssl.SSLContextImpl$TLS12Context");
   215             "sun.security.ssl.SSLContextImpl$TLS12Context");
       
   216         put("SSLContext.TLSv1.3",
       
   217             "sun.security.ssl.SSLContextImpl$TLS13Context");
   217         put("SSLContext.TLS",
   218         put("SSLContext.TLS",
   218             "sun.security.ssl.SSLContextImpl$TLSContext");
   219             "sun.security.ssl.SSLContextImpl$TLSContext");
   219         if (isfips == false) {
   220         if (isfips == false) {
   220             put("Alg.Alias.SSLContext.SSL", "TLS");
   221             put("Alg.Alias.SSLContext.SSL", "TLS");
   221             put("Alg.Alias.SSLContext.SSLv3", "TLSv1");
   222             put("Alg.Alias.SSLContext.SSLv3", "TLSv1");