diff options
Diffstat (limited to 'vendor/github.com/miekg/dns/tsig_test.go')
-rw-r--r-- | vendor/github.com/miekg/dns/tsig_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/github.com/miekg/dns/tsig_test.go b/vendor/github.com/miekg/dns/tsig_test.go index 48b9988b6..4bc52733c 100644 --- a/vendor/github.com/miekg/dns/tsig_test.go +++ b/vendor/github.com/miekg/dns/tsig_test.go @@ -1,6 +1,7 @@ package dns import ( + "encoding/binary" "testing" "time" ) @@ -22,6 +23,20 @@ func TestTsig(t *testing.T) { if err != nil { t.Fatal(err) } + + // TSIG accounts for ID substitution. This means if the message ID is + // changed by a forwarder, we should still be able to verify the TSIG. + m = newTsig(HmacMD5) + buf, _, err = TsigGenerate(m, "pRZgBrBvI4NAHZYhxmhs/Q==", "", false) + if err != nil { + t.Fatal(err) + } + + binary.BigEndian.PutUint16(buf[0:2], uint16(42)) + err = TsigVerify(buf, "pRZgBrBvI4NAHZYhxmhs/Q==", "", false) + if err != nil { + t.Fatal(err) + } } func TestTsigCase(t *testing.T) { |