Skip to content

Commit 85f7da1

Browse files
author
gefeili
committed
Merge branch 'main' into rfc-6508-sakke
2 parents b477c17 + fc91cf4 commit 85f7da1

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

prov/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import org.bouncycastle.asn1.ASN1Sequence;
5353
import org.bouncycastle.asn1.ASN1String;
5454
import org.bouncycastle.asn1.DEROctetString;
55-
import org.bouncycastle.asn1.DERSequence;
5655
import org.bouncycastle.asn1.x500.X500Name;
5756
import org.bouncycastle.asn1.x500.style.RFC4519Style;
5857
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
@@ -64,7 +63,6 @@
6463
import org.bouncycastle.asn1.x509.Extension;
6564
import org.bouncycastle.asn1.x509.GeneralName;
6665
import org.bouncycastle.asn1.x509.GeneralNames;
67-
import org.bouncycastle.asn1.x509.PolicyInformation;
6866
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
6967
import org.bouncycastle.internal.asn1.isismtt.ISISMTTObjectIdentifiers;
7068
import org.bouncycastle.jcajce.PKIXCRLStore;
@@ -968,16 +966,16 @@ protected static Set getDeltaCRLs(Date validityDate,
968966
// 5.2.4 (c)
969967
selBuilder.setMaxBaseCRLNumber(completeCRLNumber);
970968

971-
// TODO[pkix] Would adding this to the selector be helpful?
972-
//selBuilder.setDeltaCRLIndicatorEnabled(true);
969+
// NOTE: Does not restrict to critical DCI extension, so we filter non-critical ones later
970+
selBuilder.setDeltaCRLIndicatorEnabled(true);
973971

974972
PKIXCRLStoreSelector deltaSelect = selBuilder.build();
975973

976974
// find delta CRLs
977-
Set temp = PKIXCRLUtil.findCRLs(deltaSelect, validityDate, certStores, pkixCrlStores);
975+
Set deltaCRLs = getDeltaCRLs(PKIXCRLUtil.findCRLs(deltaSelect, validityDate, certStores, pkixCrlStores));
978976

979977
// if the named CRL store is empty, and we're told to check with CRLDP
980-
if (temp.isEmpty() && Properties.isOverrideSet("org.bouncycastle.x509.enableCRLDP"))
978+
if (deltaCRLs.isEmpty() && Properties.isOverrideSet("org.bouncycastle.x509.enableCRLDP"))
981979
{
982980
CertificateFactory certFact;
983981
try
@@ -1001,7 +999,7 @@ protected static Set getDeltaCRLs(Date validityDate,
1001999

10021000
for (int j = 0; j < genNames.length; j++)
10031001
{
1004-
GeneralName name = genNames[i];
1002+
GeneralName name = genNames[j];
10051003
if (name.getTagNo() == GeneralName.uniformResourceIdentifier)
10061004
{
10071005
try
@@ -1010,8 +1008,9 @@ protected static Set getDeltaCRLs(Date validityDate,
10101008
new URI(((ASN1String)name.getName()).getString()));
10111009
if (store != null)
10121010
{
1013-
temp = PKIXCRLUtil.findCRLs(deltaSelect, validityDate, Collections.EMPTY_LIST,
1014-
Collections.singletonList(store));
1011+
deltaCRLs = getDeltaCRLs(
1012+
PKIXCRLUtil.findCRLs(deltaSelect, validityDate, Collections.EMPTY_LIST,
1013+
Collections.singletonList(store)));
10151014
}
10161015
break;
10171016
}
@@ -1025,9 +1024,14 @@ protected static Set getDeltaCRLs(Date validityDate,
10251024
}
10261025
}
10271026

1027+
return deltaCRLs;
1028+
}
1029+
1030+
private static Set getDeltaCRLs(Set crls)
1031+
{
10281032
Set result = new HashSet();
10291033

1030-
for (Iterator it = temp.iterator(); it.hasNext(); )
1034+
for (Iterator it = crls.iterator(); it.hasNext(); )
10311035
{
10321036
X509CRL crl = (X509CRL)it.next();
10331037

@@ -1042,7 +1046,7 @@ protected static Set getDeltaCRLs(Date validityDate,
10421046

10431047
private static boolean isDeltaCRL(X509CRL crl)
10441048
{
1045-
return hasCriticalExtension(crl, RFC3280CertPathUtilities.DELTA_CRL_INDICATOR);
1049+
return hasCriticalExtension(crl, Extension.deltaCRLIndicator.getId());
10461050
}
10471051

10481052
/**

0 commit comments

Comments
 (0)