Skip to content

Commit 31fe006

Browse files
committed
added CRLsign check
1 parent d279409 commit 31fe006

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

pkix/src/main/java/org/bouncycastle/pkix/jcajce/RFC3280CertPathUtilities.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.bouncycastle.jcajce.PKIXExtendedParameters;
4141
import org.bouncycastle.jcajce.util.JcaJceHelper;
4242
import org.bouncycastle.util.Arrays;
43+
import org.bouncycastle.util.Properties;
4344

4445
class RFC3280CertPathUtilities
4546
{
@@ -506,14 +507,29 @@ protected static Set processCRLF(
506507
X509Certificate signCert = (X509Certificate)validCerts.get(i);
507508
boolean[] keyUsage = signCert.getKeyUsage();
508509

509-
if (keyUsage != null && (keyUsage.length <= CRL_SIGN || !keyUsage[CRL_SIGN]))
510+
if (keyUsage == null)
510511
{
511-
lastException = new AnnotatedException(
512-
"Issuer certificate key usage extension does not permit CRL signing.");
512+
if (Properties.isOverrideSet("org.bouncycastle.x509.allow_ca_without_crl_sign"))
513+
{
514+
checkKeys.add(validKeys.get(i));
515+
}
516+
else
517+
{
518+
lastException = new AnnotatedException(
519+
"No key usage extension on issuer certificate.");
520+
}
513521
}
514522
else
515523
{
516-
checkKeys.add(validKeys.get(i));
524+
if (keyUsage.length <= CRL_SIGN || !keyUsage[CRL_SIGN])
525+
{
526+
lastException = new AnnotatedException(
527+
"Issuer certificate key usage extension does not permit CRL signing.");
528+
}
529+
else
530+
{
531+
checkKeys.add(validKeys.get(i));
532+
}
517533
}
518534
}
519535

0 commit comments

Comments
 (0)