diff --git a/_examples/key2ds/key2ds.go b/_examples/key2ds/key2ds.go index 6ee1230f..59ad9ef4 100644 --- a/_examples/key2ds/key2ds.go +++ b/_examples/key2ds/key2ds.go @@ -43,10 +43,10 @@ func main() { // Foreach key would need to provide a DS records, both sha1 and sha256 if key, ok := k.(*dns.RR_DNSKEY); ok { ds := key.ToDS(dns.HashSHA1) - ds.Hdr.Ttl = 0 fmt.Printf("%v\n", ds) ds = key.ToDS(dns.HashSHA256) - ds.Hdr.Ttl = 0 + fmt.Printf("%v\n", ds) + ds = key.ToDS(dns.HashSHA384) fmt.Printf("%v\n", ds) } } diff --git a/dnssec.go b/dnssec.go index e380a4ad..ec1d4e7e 100644 --- a/dnssec.go +++ b/dnssec.go @@ -28,6 +28,8 @@ const ( AlgRSASHA256 = 8 AlgRSASHA512 = 10 AlgECCGOST = 12 + // AlgECDSAP256SHA256 = 13 + // AlgECDSAP384SHA384 = 14 ) // DNSSEC hashing codes. @@ -394,10 +396,7 @@ func (k *RR_DNSKEY) pubKeyRSA() *rsa.PublicKey { // Set the public key (the value E and N) func (k *RR_DNSKEY) setPublicKeyRSA(_E int, _N *big.Int) bool { - if _E == 0 { - return false - } - if _N == nil { + if _E == 0 || _N == nil { return false } buf := exponentToBuf(_E) @@ -406,7 +405,7 @@ func (k *RR_DNSKEY) setPublicKeyRSA(_E int, _N *big.Int) bool { return true } -// Set the public key (the value E and N) +// Set the public key (the values E and N) for RSA // RFC 3110: Section 2. RSA Public KEY Resource Records func exponentToBuf(_E int) []byte { var buf []byte