Fix the keygen alg: fill the correct bytes

This commit is contained in:
Miek Gieben 2011-01-14 19:15:25 +01:00
parent 15bf984f3f
commit 3e11fafac5
2 changed files with 7 additions and 3 deletions

2
TODO
View File

@ -4,7 +4,7 @@ Short term:
* Parsing from strings, going with goyacc and own lexer * Parsing from strings, going with goyacc and own lexer
-- develop this in its own package, then fold back to dns package? -- develop this in its own package, then fold back to dns package?
* private key to privkey format 1.3, io.Writer kind of stuff * private key to privkey format 1.3, io.Writer kind of stuff
* Signature generation * Signature generation - needs testing
* Testsuite - make it slightly better * Testsuite - make it slightly better
* Cleanup the code * Cleanup the code

View File

@ -40,12 +40,16 @@ func (r *RR_DNSKEY) Generate(bits int) (PrivateKey, os.Error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
keybuf := make([]byte, 1) keybuf := make([]byte, 2)
if priv.PublicKey.E < 256 { if priv.PublicKey.E < 256 {
keybuf[0] = uint8(priv.PublicKey.E) println(priv.PublicKey.E)
keybuf[0] = 1
keybuf[1] = uint8(priv.PublicKey.E)
} else { } else {
keybuf[0] = 0 keybuf[0] = 0
//keybuf[1] = part of length
//keybuf[2] = rest of length
// keybuf[1]+[2] have the length // keybuf[1]+[2] have the length
// keybuf[3:..3+lenght] have exponent // keybuf[3:..3+lenght] have exponent
// not implemented // not implemented