28
28
import java .time .LocalDate ;
29
29
import java .time .Month ;
30
30
import java .time .ZoneOffset ;
31
+ import java .util .Arrays ;
32
+ import java .util .Collections ;
31
33
import java .util .Date ;
34
+ import java .util .HashSet ;
32
35
import java .util .Map ;
33
36
import java .util .Set ;
34
37
@@ -44,7 +47,8 @@ final class CamerfirmaTLSPolicy {
44
47
private static final Debug debug = Debug .getInstance ("certpath" );
45
48
46
49
// 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 (
48
52
// cacerts alias: camerfirmachamberscommerceca
49
53
// DN: CN=Chambers of Commerce Root,
50
54
// OU=http://www.chambersign.org,
@@ -62,7 +66,7 @@ final class CamerfirmaTLSPolicy {
62
66
// L=Madrid (see current address at www.camerfirma.com/address),
63
67
// C=EU
64
68
"136335439334A7698016A0D324DE72284E079D7B5220BB8FBD747816EEBEBACA"
65
- );
69
+ ))) ;
66
70
67
71
// Any TLS Server certificate that is anchored by one of the Camerfirma
68
72
// roots above and is issued after this date will be distrusted.
@@ -87,8 +91,8 @@ static void checkDistrust(X509Certificate[] chain)
87
91
}
88
92
if (FINGERPRINTS .contains (fp )) {
89
93
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 ( );
92
96
// reject if certificate is issued after April 15, 2025
93
97
checkNotBefore (ldNotBefore , APRIL_15_2025 , anchor );
94
98
}
0 commit comments