Skip to content

Commit 4a8a9f1

Browse files
Aleksei VoitylovRealCLanger
authored andcommitted
8371830: Enhance certificate chain validation
Reviewed-by: abakhtin, mbaesken Backport-of: 970e7df70e5f9044f6fe872d6d166c82fe68ebdc
1 parent 10577ca commit 4a8a9f1

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, 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
@@ -43,9 +43,7 @@
4343

4444
/**
4545
* Class to obtain CRLs via the CRLDistributionPoints extension.
46-
* Note that the functionality of this class must be explicitly enabled
47-
* via a system property, see the USE_CRLDP variable below.
48-
*
46+
* <p>
4947
* This class uses the URICertStore class to fetch CRLs. The URICertStore
5048
* class also implements CRL caching: see the class description for more
5149
* information.

src/java.base/share/classes/sun/security/provider/certpath/RevocationChecker.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, 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
@@ -1022,13 +1022,17 @@ private void buildToNewKey(X509Certificate currCert,
10221022
// any way to convey them back to the application.
10231023
// That's the default, so no need to write code.
10241024
builderParams.setDate(params.date());
1025-
builderParams.setCertPathCheckers(params.certPathCheckers());
10261025
builderParams.setSigProvider(params.sigProvider());
10271026

10281027
// Skip revocation during this build to detect circular
10291028
// references. But check revocation afterwards, using the
10301029
// key (or any other that works).
10311030
builderParams.setRevocationEnabled(false);
1031+
// Remove itself from params to avoid circular reference.
1032+
builderParams.setCertPathCheckers(params.certPathCheckers()
1033+
.stream()
1034+
.filter(checker -> checker != this)
1035+
.toList());
10321036

10331037
// check for AuthorityInformationAccess extension
10341038
if (Builder.USE_AIA) {

0 commit comments

Comments
 (0)