This commit is contained in:
Miek Gieben 2011-12-16 19:42:30 +01:00
parent a72df87858
commit cac5cf451b
2 changed files with 11 additions and 11 deletions

View File

@ -23,8 +23,8 @@ func ReadPrivateKey(q io.Reader) (PrivateKey, error) {
} }
switch m["algorithm"] { switch m["algorithm"] {
case "1 (RSAMD5)", "5 (RSASHA1)", "8 (RSASHA256)", "10 (RSASHA512)": case "1 (RSAMD5)", "5 (RSASHA1)", "8 (RSASHA256)", "10 (RSASHA512)":
fallthrough fallthrough
case "7 (RSASHA1NSEC3SHA1)": case "7 (RSASHA1NSEC3SHA1)":
return readPrivateKeyRSA(m) return readPrivateKeyRSA(m)
case "13 (ECDSAP256SHA256)", "14 (ECDSAP384SHA384)": case "13 (ECDSAP256SHA256)", "14 (ECDSAP384SHA384)":
return readPrivateKeyECDSA(m) return readPrivateKeyECDSA(m)
@ -110,7 +110,7 @@ func ParseKey(r io.Reader) (map[string]string, error) {
if k == "" { if k == "" {
return nil, &ParseError{"No key seen", l} return nil, &ParseError{"No key seen", l}
} }
//println("Setting", strings.ToLower(k), "to", l.token, "b") //println("Setting", strings.ToLower(k), "to", l.token, "b")
m[strings.ToLower(k)] = l.token m[strings.ToLower(k)] = l.token
k = "" k = ""
} }
@ -134,14 +134,14 @@ func klexer(s scanner.Scanner, c chan lex) {
if commt { if commt {
break break
} }
l.token = str l.token = str
if key { if key {
l.value = _KEY l.value = _KEY
c <- l c <- l
// Next token is a space, eat it // Next token is a space, eat it
s.Scan() s.Scan()
key = false key = false
str = "" str = ""
} else { } else {
l.value = _VALUE l.value = _VALUE
} }
@ -152,8 +152,8 @@ func klexer(s scanner.Scanner, c chan lex) {
// Reset a comment // Reset a comment
commt = false commt = false
} }
l.value = _VALUE l.value = _VALUE
l.token = str l.token = str
c <- l c <- l
str = "" str = ""
commt = false commt = false

View File

@ -38,13 +38,13 @@ func HashName(label string, ha, iter int, salt string) string {
// k = 0 // k = 0
name = append(name, wire...) name = append(name, wire...)
io.WriteString(s, string(name)) io.WriteString(s, string(name))
nsec3 := s.Sum(nil) nsec3 := s.Sum(nil)
// k > 0 // k > 0
for k := 0; k < iter; k++ { for k := 0; k < iter; k++ {
s.Reset() s.Reset()
nsec3 = append(nsec3, wire...) nsec3 = append(nsec3, wire...)
io.WriteString(s, string(nsec3)) io.WriteString(s, string(nsec3))
nsec3 = s.Sum(nil) nsec3 = s.Sum(nil)
} }
return unpackBase32(nsec3) return unpackBase32(nsec3)