Tweaks preparing for ECC

This commit is contained in:
Miek Gieben 2011-07-07 11:19:57 +02:00
parent df10cc187e
commit 582766d6fe
2 changed files with 6 additions and 7 deletions

View File

@ -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)
}
}

View File

@ -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