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
-- develop this in its own package, then fold back to dns package?
* private key to privkey format 1.3, io.Writer kind of stuff
* Signature generation
* Signature generation - needs testing
* Testsuite - make it slightly better
* Cleanup the code

View File

@ -40,12 +40,16 @@ func (r *RR_DNSKEY) Generate(bits int) (PrivateKey, os.Error) {
if err != nil {
return nil, err
}
keybuf := make([]byte, 1)
keybuf := make([]byte, 2)
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 {
keybuf[0] = 0
//keybuf[1] = part of length
//keybuf[2] = rest of length
// keybuf[1]+[2] have the length
// keybuf[3:..3+lenght] have exponent
// not implemented