@@ -18,28 +18,28 @@ import (
1818)
1919
2020func TestGenerateCRLTimeBounds (t * testing.T ) {
21- _ , err := generateCRL (nil , nil , time .Now ().Add (time .Hour ), time .Now (), 1 , nil )
21+ _ , err := generateCRL (nil , nil , time .Now ().Add (time .Hour ), time .Now (), 1 , nil , [] string {} )
2222 test .AssertError (t , err , "generateCRL did not fail" )
2323 test .AssertEquals (t , err .Error (), "thisUpdate must be before nextUpdate" )
2424
2525 _ , err = generateCRL (nil , & x509.Certificate {
2626 NotBefore : time .Now ().Add (time .Hour ),
2727 NotAfter : time .Now (),
28- }, time .Now (), time .Now (), 1 , nil )
28+ }, time .Now (), time .Now (), 1 , nil , [] string {} )
2929 test .AssertError (t , err , "generateCRL did not fail" )
3030 test .AssertEquals (t , err .Error (), "thisUpdate is before issuing certificate's notBefore" )
3131
3232 _ , err = generateCRL (nil , & x509.Certificate {
3333 NotBefore : time .Now (),
3434 NotAfter : time .Now ().Add (time .Hour * 2 ),
35- }, time .Now ().Add (time .Hour ), time .Now ().Add (time .Hour * 3 ), 1 , nil )
35+ }, time .Now ().Add (time .Hour ), time .Now ().Add (time .Hour * 3 ), 1 , nil , [] string {} )
3636 test .AssertError (t , err , "generateCRL did not fail" )
3737 test .AssertEquals (t , err .Error (), "nextUpdate is after issuing certificate's notAfter" )
3838
3939 _ , err = generateCRL (nil , & x509.Certificate {
4040 NotBefore : time .Now (),
4141 NotAfter : time .Now ().Add (time .Hour * 24 * 370 ),
42- }, time .Now (), time .Now ().Add (time .Hour * 24 * 366 ), 1 , nil )
42+ }, time .Now (), time .Now ().Add (time .Hour * 24 * 366 ), 1 , nil , [] string {} )
4343 test .AssertError (t , err , "generateCRL did not fail" )
4444 test .AssertEquals (t , err .Error (), "nextUpdate must be less than 12 months after thisUpdate" )
4545}
@@ -79,17 +79,26 @@ func TestGenerateCRLLints(t *testing.T) {
7979 cert , err = x509 .ParseCertificate (certBytes )
8080 test .AssertNotError (t , err , "failed to parse test cert" )
8181
82- // This CRL should fail the following lint:
83- // - e_crl_acceptable_reason_codes (because 6 is forbidden)
82+ // This CRL should fail the "e_crl_next_update_invalid" lint because the
83+ // validity interval is more than 10 days, and this lint can't tell the
84+ // difference between end-entity and CA CRLs.
8485 _ , err = generateCRL (& wrappedSigner {k }, cert , time .Now ().Add (time .Hour ), time .Now ().Add (100 * 24 * time .Hour ), 1 , []x509.RevocationListEntry {
8586 {
8687 SerialNumber : big .NewInt (12345 ),
8788 RevocationTime : time .Now ().Add (time .Hour ),
88- ReasonCode : 6 ,
8989 },
90- })
90+ }, [] string {} )
9191 test .AssertError (t , err , "generateCRL did not fail" )
92- test .AssertContains (t , err .Error (), "e_crl_acceptable_reason_codes" )
92+ test .AssertContains (t , err .Error (), "e_crl_next_update_invalid" )
93+
94+ // But we can tell it to ignore that lint, too.
95+ _ , err = generateCRL (& wrappedSigner {k }, cert , time .Now ().Add (time .Hour ), time .Now ().Add (100 * 24 * time .Hour ), 1 , []x509.RevocationListEntry {
96+ {
97+ SerialNumber : big .NewInt (12345 ),
98+ RevocationTime : time .Now ().Add (time .Hour ),
99+ },
100+ }, []string {"e_crl_next_update_invalid" })
101+ test .AssertNotError (t , err , "generateCRL should have ignored the failing lint" )
93102}
94103
95104func TestGenerateCRL (t * testing.T ) {
@@ -112,7 +121,7 @@ func TestGenerateCRL(t *testing.T) {
112121 cert , err := x509 .ParseCertificate (certBytes )
113122 test .AssertNotError (t , err , "failed to parse test cert" )
114123
115- crlPEM , err := generateCRL (& wrappedSigner {k }, cert , time .Now ().Add (time .Hour ), time .Now ().Add (time .Hour * 2 ), 1 , nil )
124+ crlPEM , err := generateCRL (& wrappedSigner {k }, cert , time .Now ().Add (time .Hour ), time .Now ().Add (time .Hour * 2 ), 1 , nil , [] string {} )
116125 test .AssertNotError (t , err , "generateCRL failed with valid profile" )
117126
118127 pemBlock , _ := pem .Decode (crlPEM )
0 commit comments