Skip to content

Commit

Permalink
added correct handling for CRL files with no data
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed May 9, 2017
1 parent 05b83be commit a0fa0f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ private CRL readDERCRL(
private CRL getCRL(ASN1Sequence seq)
throws CRLException
{
if (seq == null)
{
return null;
}

if (seq.size() > 1
&& seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,17 @@ private void pemFileTest()
isTrue("collection not empty", certs2.isEmpty());
}

private void invalidCRLs()
throws Exception
{
CertificateFactory certFact = CertificateFactory.getInstance("X.509", "BC");

Collection crls = certFact.generateCRLs(this.getClass().getResourceAsStream("cert_chain.txt"));
isTrue("multi crl", crls.isEmpty());
CRL crl = certFact.generateCRL(this.getClass().getResourceAsStream("cert_chain.txt"));
isTrue("single crl", crl == null);
}

private void pemFileTestWithNl()
throws Exception
{
Expand Down Expand Up @@ -1868,7 +1879,9 @@ public void performTest()
pemFileTestWithNl();
pkcs7Test();
rfc4491Test();


invalidCRLs();

testForgedSignature();

checkCertificate(18, emptyDNCert);
Expand Down

0 comments on commit a0fa0f7

Please sign in to comment.