Standard library / crypto/x509/pkix
crypto/x509/pkix.CertificateList.HasExpired()
Legacy CRL method checks NextUpdate relative to the supplied time. This alone does not validate a CRL. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (certList *CertificateList) HasExpired(now time.Time) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| now | time.Time | Time of creation or comparison. |
Return Value
bool
Result as described above; check any returned error before use.
Working Example
Example Snippetgo
package main
import ( "crypto/x509/pkix" "fmt" "time")
func main() { // Historical interoperability demonstration only. Prefer modern protocols for new designs. t := time.Unix(100, 0) c := pkix.CertificateList{TBSCertList: pkix.TBSCertificateList{NextUpdate: t}} fmt.Println(c.HasExpired(t.Add(time.Second)))}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}