Small api change to check RRSIG validity

This commit is contained in:
Miek Gieben 2014-01-27 14:42:17 +00:00
parent 9c0ff1489b
commit 39a8e2b8af
1 changed files with 9 additions and 3 deletions

View File

@ -426,9 +426,15 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
}
// ValidityPeriod uses RFC1982 serial arithmetic to calculate
// if a signature period is valid.
func (rr *RRSIG) ValidityPeriod() bool {
utc := time.Now().UTC().Unix()
// if a signature period is valid. If t is the zero time, the
// current time is taken other t is.
func (rr *RRSIG) ValidityPeriod(t time.Tim) bool {
var utc int64
if t == time.Zero {
utc = time.Now().UTC().Unix()
} else {
utc = t.Now().UTC().Unix()
}
modi := (int64(rr.Inception) - utc) / year68
mode := (int64(rr.Expiration) - utc) / year68
ti := int64(rr.Inception) + (modi * year68)