Skip to content

Commit 39221f8

Browse files
franferraxgnu-andrew
authored andcommitted
8337664: Distrust TLS server certificates issued after Oct 2024 and anchored by Entrust Root CAs
Reviewed-by: sgehwolf, andrew Backport-of: 7d49c52
1 parent e32d62e commit 39221f8

17 files changed

+1125
-6
lines changed

jdk/src/share/classes/sun/security/validator/CADistrustPolicy.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -53,6 +53,22 @@ void checkDistrust(String variant, X509Certificate[] chain)
5353
}
5454
SymantecTLSPolicy.checkDistrust(chain);
5555
}
56+
},
57+
58+
/**
59+
* Distrust TLS Server certificates anchored by an Entrust root CA and
60+
* issued after October 31, 2024. If enabled, this policy is currently
61+
* enforced by the PKIX and SunX509 TrustManager implementations
62+
* of the SunJSSE provider implementation.
63+
*/
64+
ENTRUST_TLS {
65+
void checkDistrust(String variant, X509Certificate[] chain)
66+
throws ValidatorException {
67+
if (!variant.equals(Validator.VAR_TLS_SERVER)) {
68+
return;
69+
}
70+
EntrustTLSPolicy.checkDistrust(chain);
71+
}
5672
};
5773

5874
/**
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package sun.security.validator;
26+
27+
import java.security.cert.X509Certificate;
28+
import java.time.LocalDate;
29+
import java.time.Month;
30+
import java.time.ZoneOffset;
31+
import java.util.Arrays;
32+
import java.util.Collections;
33+
import java.util.Date;
34+
import java.util.HashSet;
35+
import java.util.Map;
36+
import java.util.Set;
37+
38+
import sun.security.util.Debug;
39+
import sun.security.x509.X509CertImpl;
40+
41+
/**
42+
* This class checks if Entrust issued TLS Server certificates should be
43+
* restricted.
44+
*/
45+
final class EntrustTLSPolicy {
46+
47+
private static final Debug debug = Debug.getInstance("certpath");
48+
49+
// SHA-256 certificate fingerprints of distrusted roots
50+
private static final Set<String> FINGERPRINTS =
51+
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
52+
// cacerts alias: entrustevca
53+
// DN: CN=Entrust Root Certification Authority,
54+
// OU=(c) 2006 Entrust, Inc.,
55+
// OU=www.entrust.net/CPS is incorporated by reference,
56+
// O=Entrust, Inc., C=US
57+
"73C176434F1BC6D5ADF45B0E76E727287C8DE57616C1E6E6141A2B2CBC7D8E4C",
58+
// cacerts alias: entrustrootcaec1
59+
// DN: CN=Entrust Root Certification Authority - EC1,
60+
// OU=(c) 2012 Entrust, Inc. - for authorized use only,
61+
// OU=See www.entrust.net/legal-terms, O=Entrust, Inc., C=US
62+
"02ED0EB28C14DA45165C566791700D6451D7FB56F0B2AB1D3B8EB070E56EDFF5",
63+
// cacerts alias: entrustrootcag2
64+
// DN: CN=Entrust Root Certification Authority - G2,
65+
// OU=(c) 2009 Entrust, Inc. - for authorized use only,
66+
// OU=See www.entrust.net/legal-terms, O=Entrust, Inc., C=US
67+
"43DF5774B03E7FEF5FE40D931A7BEDF1BB2E6B42738C4E6D3841103D3AA7F339",
68+
// cacerts alias: entrustrootcag4
69+
// DN: CN=Entrust Root Certification Authority - G4
70+
// OU=(c) 2015 Entrust, Inc. - for authorized use only,
71+
// OU=See www.entrust.net/legal-terms, O=Entrust, Inc., C=US,
72+
"DB3517D1F6732A2D5AB97C533EC70779EE3270A62FB4AC4238372460E6F01E88",
73+
// cacerts alias: entrust2048ca
74+
// DN: CN=Entrust.net Certification Authority (2048),
75+
// OU=(c) 1999 Entrust.net Limited,
76+
// OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),
77+
// O=Entrust.net
78+
"6DC47172E01CBCB0BF62580D895FE2B8AC9AD4F873801E0C10B9C837D21EB177",
79+
// cacerts alias: affirmtrustcommercialca
80+
// DN: CN=AffirmTrust Commercial, O=AffirmTrust, C=US
81+
"0376AB1D54C5F9803CE4B2E201A0EE7EEF7B57B636E8A93C9B8D4860C96F5FA7",
82+
// cacerts alias: affirmtrustnetworkingca
83+
// DN: CN=AffirmTrust Networking, O=AffirmTrust, C=US
84+
"0A81EC5A929777F145904AF38D5D509F66B5E2C58FCDB531058B0E17F3F0B41B",
85+
// cacerts alias: affirmtrustpremiumca
86+
// DN: CN=AffirmTrust Premium, O=AffirmTrust, C=US
87+
"70A73F7F376B60074248904534B11482D5BF0E698ECC498DF52577EBF2E93B9A",
88+
// cacerts alias: affirmtrustpremiumeccca
89+
// DN: CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US
90+
"BD71FDF6DA97E4CF62D1647ADD2581B07D79ADF8397EB4ECBA9C5E8488821423"
91+
)));
92+
93+
// Any TLS Server certificate that is anchored by one of the Entrust
94+
// roots above and is issued after this date will be distrusted.
95+
private static final LocalDate OCTOBER_31_2024 =
96+
LocalDate.of(2024, Month.OCTOBER, 31);
97+
98+
/**
99+
* This method assumes the eeCert is a TLS Server Cert and chains back to
100+
* the anchor.
101+
*
102+
* @param chain the end-entity's certificate chain. The end entity cert
103+
* is at index 0, the trust anchor at index n-1.
104+
* @throws ValidatorException if the certificate is distrusted
105+
*/
106+
static void checkDistrust(X509Certificate[] chain)
107+
throws ValidatorException {
108+
X509Certificate anchor = chain[chain.length-1];
109+
String fp = fingerprint(anchor);
110+
if (fp == null) {
111+
throw new ValidatorException("Cannot generate fingerprint for "
112+
+ "trust anchor of TLS server certificate");
113+
}
114+
if (FINGERPRINTS.contains(fp)) {
115+
Date notBefore = chain[0].getNotBefore();
116+
LocalDate ldNotBefore = notBefore.toInstant()
117+
.atZone(ZoneOffset.UTC).toLocalDate();
118+
// reject if certificate is issued after October 31, 2024
119+
checkNotBefore(ldNotBefore, OCTOBER_31_2024, anchor);
120+
}
121+
}
122+
123+
private static String fingerprint(X509Certificate cert) {
124+
return X509CertImpl.getFingerprint("SHA-256", cert);
125+
}
126+
127+
private static void checkNotBefore(LocalDate notBeforeDate,
128+
LocalDate distrustDate, X509Certificate anchor)
129+
throws ValidatorException {
130+
if (notBeforeDate.isAfter(distrustDate)) {
131+
throw new ValidatorException
132+
("TLS Server certificate issued after " + distrustDate +
133+
" and anchored by a distrusted legacy Entrust root CA: "
134+
+ anchor.getSubjectX500Principal(),
135+
ValidatorException.T_UNTRUSTED_CERT, anchor);
136+
}
137+
}
138+
139+
private EntrustTLSPolicy() {}
140+
}

jdk/src/share/lib/security/java.security-aix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,10 @@ jdk.sasl.disabledMechanisms=
12111211
# 2. Apple IST CA 8 - G1, SHA-256 fingerprint:
12121212
# A4FE7C7F15155F3F0AEF7AAA83CF6E06DEB97CA3F909DF920AC1490882D488ED
12131213
# Distrust after December 31, 2019.
1214+
#
1215+
# ENTRUST_TLS : Distrust TLS Server certificates anchored by
1216+
# an Entrust root CA and issued after October 31, 2024.
1217+
#
12141218
# Leading and trailing whitespace surrounding each value are ignored.
12151219
# Unknown values are ignored. If the property is commented out or set to the
12161220
# empty String, no policies are enforced.
@@ -1222,7 +1226,7 @@ jdk.sasl.disabledMechanisms=
12221226
# jdk.certpath.disabledAlgorithms; those restrictions are still enforced even
12231227
# if this property is not enabled.
12241228
#
1225-
jdk.security.caDistrustPolicies=SYMANTEC_TLS
1229+
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS
12261230

12271231
#
12281232
# Policies for the proxy_impersonator Kerberos ccache configuration entry

jdk/src/share/lib/security/java.security-linux

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,10 @@ jdk.sasl.disabledMechanisms=
12171217
# 2. Apple IST CA 8 - G1, SHA-256 fingerprint:
12181218
# A4FE7C7F15155F3F0AEF7AAA83CF6E06DEB97CA3F909DF920AC1490882D488ED
12191219
# Distrust after December 31, 2019.
1220+
#
1221+
# ENTRUST_TLS : Distrust TLS Server certificates anchored by
1222+
# an Entrust root CA and issued after October 31, 2024.
1223+
#
12201224
# Leading and trailing whitespace surrounding each value are ignored.
12211225
# Unknown values are ignored. If the property is commented out or set to the
12221226
# empty String, no policies are enforced.
@@ -1228,7 +1232,7 @@ jdk.sasl.disabledMechanisms=
12281232
# jdk.certpath.disabledAlgorithms; those restrictions are still enforced even
12291233
# if this property is not enabled.
12301234
#
1231-
jdk.security.caDistrustPolicies=SYMANTEC_TLS
1235+
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS
12321236

12331237
#
12341238
# Policies for the proxy_impersonator Kerberos ccache configuration entry

jdk/src/share/lib/security/java.security-macosx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,10 @@ jdk.sasl.disabledMechanisms=
12151215
# 2. Apple IST CA 8 - G1, SHA-256 fingerprint:
12161216
# A4FE7C7F15155F3F0AEF7AAA83CF6E06DEB97CA3F909DF920AC1490882D488ED
12171217
# Distrust after December 31, 2019.
1218+
#
1219+
# ENTRUST_TLS : Distrust TLS Server certificates anchored by
1220+
# an Entrust root CA and issued after October 31, 2024.
1221+
#
12181222
# Leading and trailing whitespace surrounding each value are ignored.
12191223
# Unknown values are ignored. If the property is commented out or set to the
12201224
# empty String, no policies are enforced.
@@ -1226,7 +1230,7 @@ jdk.sasl.disabledMechanisms=
12261230
# jdk.certpath.disabledAlgorithms; those restrictions are still enforced even
12271231
# if this property is not enabled.
12281232
#
1229-
jdk.security.caDistrustPolicies=SYMANTEC_TLS
1233+
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS
12301234

12311235
#
12321236
# Policies for the proxy_impersonator Kerberos ccache configuration entry

jdk/src/share/lib/security/java.security-solaris

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,10 @@ jdk.sasl.disabledMechanisms=
12131213
# 2. Apple IST CA 8 - G1, SHA-256 fingerprint:
12141214
# A4FE7C7F15155F3F0AEF7AAA83CF6E06DEB97CA3F909DF920AC1490882D488ED
12151215
# Distrust after December 31, 2019.
1216+
#
1217+
# ENTRUST_TLS : Distrust TLS Server certificates anchored by
1218+
# an Entrust root CA and issued after October 31, 2024.
1219+
#
12161220
# Leading and trailing whitespace surrounding each value are ignored.
12171221
# Unknown values are ignored. If the property is commented out or set to the
12181222
# empty String, no policies are enforced.
@@ -1224,7 +1228,7 @@ jdk.sasl.disabledMechanisms=
12241228
# jdk.certpath.disabledAlgorithms; those restrictions are still enforced even
12251229
# if this property is not enabled.
12261230
#
1227-
jdk.security.caDistrustPolicies=SYMANTEC_TLS
1231+
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS
12281232

12291233
#
12301234
# Policies for the proxy_impersonator Kerberos ccache configuration entry

jdk/src/share/lib/security/java.security-windows

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,10 @@ jdk.sasl.disabledMechanisms=
12151215
# 2. Apple IST CA 8 - G1, SHA-256 fingerprint:
12161216
# A4FE7C7F15155F3F0AEF7AAA83CF6E06DEB97CA3F909DF920AC1490882D488ED
12171217
# Distrust after December 31, 2019.
1218+
#
1219+
# ENTRUST_TLS : Distrust TLS Server certificates anchored by
1220+
# an Entrust root CA and issued after October 31, 2024.
1221+
#
12181222
# Leading and trailing whitespace surrounding each value are ignored.
12191223
# Unknown values are ignored. If the property is commented out or set to the
12201224
# empty String, no policies are enforced.
@@ -1226,7 +1230,7 @@ jdk.sasl.disabledMechanisms=
12261230
# jdk.certpath.disabledAlgorithms; those restrictions are still enforced even
12271231
# if this property is not enabled.
12281232
#
1229-
jdk.security.caDistrustPolicies=SYMANTEC_TLS
1233+
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS
12301234

12311235
#
12321236
# Policies for the proxy_impersonator Kerberos ccache configuration entry

0 commit comments

Comments
 (0)