Skip to content

Commit

Permalink
Getter method for cert hash
Browse files Browse the repository at this point in the history
Useful downstream where we need to see if cache has a specific cert
  • Loading branch information
mholt committed Jul 10, 2023
1 parent f01bd63 commit fb1700b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type Certificate struct {
// most recent OCSP response we have for this certificate.
ocsp *ocsp.Response

// The hex-encoded hash of this cert's chain's bytes.
// The hex-encoded hash of this cert's chain's DER bytes.
hash string

// Whether this certificate is under our management.
Expand All @@ -64,6 +64,9 @@ func (cert Certificate) Empty() bool {
return len(cert.Certificate.Certificate) == 0
}

// Hash returns a checksum of the certificate chain's DER-encoded bytes.
func (cert Certificate) Hash() string { return cert.hash }

// NeedsRenewal returns true if the certificate is
// expiring soon (according to cfg) or has expired.
func (cert Certificate) NeedsRenewal(cfg *Config) bool {
Expand Down

0 comments on commit fb1700b

Please sign in to comment.