@@ -267,10 +267,23 @@ func TestRequestValid(t *testing.T) {
267267 request : & IssuanceRequest {
268268 PublicKey : & ecdsa.PublicKey {},
269269 NotBefore : fc .Now (),
270- NotAfter : fc .Now ().Add (time .Hour ),
270+ NotAfter : fc .Now ().Add (time .Hour - time . Second ),
271271 },
272272 expectedError : "validity period is more than the maximum allowed period (1h0m0s>1m0s)" ,
273273 },
274+ {
275+ name : "validity larger than max due to inclusivity" ,
276+ profile : & Profile {
277+ useForECDSALeaves : true ,
278+ maxValidity : time .Hour ,
279+ },
280+ request : & IssuanceRequest {
281+ PublicKey : & ecdsa.PublicKey {},
282+ NotBefore : fc .Now (),
283+ NotAfter : fc .Now ().Add (time .Hour ),
284+ },
285+ expectedError : "validity period is more than the maximum allowed period (1h0m1s>1h0m0s)" ,
286+ },
274287 {
275288 name : "validity backdated more than max" ,
276289 profile : & Profile {
@@ -536,7 +549,7 @@ func TestIssue(t *testing.T) {
536549 CommonName : "example.com" ,
537550 DNSNames : []string {"example.com" },
538551 NotBefore : fc .Now (),
539- NotAfter : fc .Now ().Add (time .Hour ),
552+ NotAfter : fc .Now ().Add (time .Hour - time . Second ),
540553 })
541554 test .AssertNotError (t , err , "Issue failed" )
542555 cert , err := x509 .ParseCertificate (certBytes )
@@ -569,7 +582,7 @@ func TestIssueRSA(t *testing.T) {
569582 Serial : []byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 },
570583 DNSNames : []string {"example.com" },
571584 NotBefore : fc .Now (),
572- NotAfter : fc .Now ().Add (time .Hour ),
585+ NotAfter : fc .Now ().Add (time .Hour - time . Second ),
573586 })
574587 test .AssertNotError (t , err , "Issue failed" )
575588 cert , err := x509 .ParseCertificate (certBytes )
@@ -599,7 +612,7 @@ func TestIssueCTPoison(t *testing.T) {
599612 DNSNames : []string {"example.com" },
600613 IncludeCTPoison : true ,
601614 NotBefore : fc .Now (),
602- NotAfter : fc .Now ().Add (time .Hour ),
615+ NotAfter : fc .Now ().Add (time .Hour - time . Second ),
603616 })
604617 test .AssertNotError (t , err , "Issue failed" )
605618 cert , err := x509 .ParseCertificate (certBytes )
@@ -631,7 +644,7 @@ func TestIssueSCTList(t *testing.T) {
631644 {},
632645 },
633646 NotBefore : fc .Now (),
634- NotAfter : fc .Now ().Add (time .Hour ),
647+ NotAfter : fc .Now ().Add (time .Hour - time . Second ),
635648 })
636649 test .AssertNotError (t , err , "Issue failed" )
637650 cert , err := x509 .ParseCertificate (certBytes )
@@ -664,7 +677,7 @@ func TestIssueMustStaple(t *testing.T) {
664677 DNSNames : []string {"example.com" },
665678 IncludeMustStaple : true ,
666679 NotBefore : fc .Now (),
667- NotAfter : fc .Now ().Add (time .Hour ),
680+ NotAfter : fc .Now ().Add (time .Hour - time . Second ),
668681 })
669682 test .AssertNotError (t , err , "Issue failed" )
670683 cert , err := x509 .ParseCertificate (certBytes )
@@ -690,7 +703,7 @@ func TestIssueBadLint(t *testing.T) {
690703 Serial : []byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 },
691704 DNSNames : []string {"example.com" },
692705 NotBefore : fc .Now (),
693- NotAfter : fc .Now ().Add (time .Hour ),
706+ NotAfter : fc .Now ().Add (time .Hour - time . Second ),
694707 })
695708 test .AssertError (t , err , "Issue didn't fail" )
696709 test .AssertEquals (t , err .Error (), "tbsCertificate linting failed: failed lints: w_ct_sct_policy_count_unsatisfied" )
0 commit comments