Skip to content

Commit fcc2105

Browse files
Check the certificate expiration date
1 parent 3e5f9e6 commit fcc2105

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

certificates/certificates.go

+9
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,12 @@ func DeleteCertificates(certDir *paths.Path) {
267267
certDir.Join("cert.pem").Remove()
268268
certDir.Join("cert.cer").Remove()
269269
}
270+
271+
// IsExpired checks if a certificate is expired
272+
func IsExpired() bool {
273+
bound := time.Now().AddDate(0, 1, 0)
274+
// TODO: manage errors
275+
dateS, _ := GetExpirationDate()
276+
date, _ := time.Parse(time.DateTime, dateS)
277+
return date.Before(bound)
278+
}

0 commit comments

Comments
 (0)