This commit is contained in:
Miek Gieben 2012-05-05 17:37:48 +02:00
parent c96d86da1f
commit 3611c4d458
7 changed files with 23 additions and 25 deletions

View File

@ -106,7 +106,7 @@ func (k *RR_DNSKEY) KeyTag() uint16 {
// item in the pubkey. We could do this faster by looking directly
// at the base64 values. But I'm lazy.
modulus, _ := packBase64([]byte(k.PublicKey))
if (len(modulus) > 1) {
if len(modulus) > 1 {
x, _ := unpackUint16(modulus, len(modulus)-2)
keytag = int(x)
}
@ -545,11 +545,11 @@ func (k *RR_DNSKEY) publicKeyDSA() *dsa.PublicKey {
pubkey.Parameters.Q = big.NewInt(0)
pubkey.Parameters.Q.SetBytes(keybuf[1:21]) // +/- 1 ?
pubkey.Parameters.P = big.NewInt(0)
pubkey.Parameters.P.SetBytes(keybuf[22:22+size])
pubkey.Parameters.P.SetBytes(keybuf[22 : 22+size])
pubkey.Parameters.G = big.NewInt(0)
pubkey.Parameters.G.SetBytes(keybuf[22+size+1:22+size*2])
pubkey.Parameters.G.SetBytes(keybuf[22+size+1 : 22+size*2])
pubkey.Y = big.NewInt(0)
pubkey.Y.SetBytes(keybuf[22+size*2+1:22+size*3])
pubkey.Y.SetBytes(keybuf[22+size*2+1 : 22+size*3])
return pubkey
}

View File

@ -1,11 +1,11 @@
package dns
import (
"crypto/dsa"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"crypto/dsa"
"math/big"
"strconv"
)

View File

@ -1,9 +1,9 @@
package dns
import (
"crypto/dsa"
"crypto/ecdsa"
"crypto/rsa"
"crypto/dsa"
"io"
"math/big"
"strings"
@ -155,8 +155,8 @@ func readPrivateKeyECDSA(m map[string]string) (PrivateKey, error) {
}
func readPrivateKeyGOST(m map[string]string) (PrivateKey, error) {
// p := new(ecdsa.PrivateKey)
// p.D = big.NewInt(0)
// p := new(ecdsa.PrivateKey)
// p.D = big.NewInt(0)
// Need to check if we have everything
for k, v := range m {
switch k {

View File

@ -253,10 +253,8 @@ func TestParseNSEC(t *testing.T) {
func TestParseLOC(t *testing.T) {
lt := map[string]string{
"SW1A2AA.find.me.uk. LOC 51 30 12.748 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m":
"SW1A2AA.find.me.uk.\t3600\tIN\tLOC\t51 30 12.748 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m",
"SW1A2AA.find.me.uk. LOC 51 0 0.0 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m":
"SW1A2AA.find.me.uk.\t3600\tIN\tLOC\t51 00 0.000 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m",
"SW1A2AA.find.me.uk. LOC 51 30 12.748 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m": "SW1A2AA.find.me.uk.\t3600\tIN\tLOC\t51 30 12.748 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m",
"SW1A2AA.find.me.uk. LOC 51 0 0.0 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m": "SW1A2AA.find.me.uk.\t3600\tIN\tLOC\t51 00 0.000 N 00 07 39.611 W 0.00m 0.00m 0.00m 0.00m",
}
for i, o := range lt {
rr, e := NewRR(i)