Skip to content

Commit 701a9c1

Browse files
committed
JDK 8u adjustments for CamerfirmaTLSPolicy
1 parent b30105c commit 701a9c1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
import java.time.LocalDate;
2929
import java.time.Month;
3030
import java.time.ZoneOffset;
31+
import java.util.Arrays;
32+
import java.util.Collections;
3133
import java.util.Date;
34+
import java.util.HashSet;
3235
import java.util.Map;
3336
import java.util.Set;
3437

@@ -44,7 +47,8 @@ final class CamerfirmaTLSPolicy {
4447
private static final Debug debug = Debug.getInstance("certpath");
4548

4649
// SHA-256 certificate fingerprints of distrusted roots
47-
private static final Set<String> FINGERPRINTS = Set.of(
50+
private static final Set<String> FINGERPRINTS =
51+
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
4852
// cacerts alias: camerfirmachamberscommerceca
4953
// DN: CN=Chambers of Commerce Root,
5054
// OU=http://www.chambersign.org,
@@ -62,7 +66,7 @@ final class CamerfirmaTLSPolicy {
6266
// L=Madrid (see current address at www.camerfirma.com/address),
6367
// C=EU
6468
"136335439334A7698016A0D324DE72284E079D7B5220BB8FBD747816EEBEBACA"
65-
);
69+
)));
6670

6771
// Any TLS Server certificate that is anchored by one of the Camerfirma
6872
// roots above and is issued after this date will be distrusted.
@@ -87,8 +91,8 @@ static void checkDistrust(X509Certificate[] chain)
8791
}
8892
if (FINGERPRINTS.contains(fp)) {
8993
Date notBefore = chain[0].getNotBefore();
90-
LocalDate ldNotBefore = LocalDate.ofInstant(notBefore.toInstant(),
91-
ZoneOffset.UTC);
94+
LocalDate ldNotBefore = notBefore.toInstant()
95+
.atZone(ZoneOffset.UTC).toLocalDate();
9296
// reject if certificate is issued after April 15, 2025
9397
checkNotBefore(ldNotBefore, APRIL_15_2025, anchor);
9498
}

0 commit comments

Comments
 (0)