Allow any body length, even if sigoptions.bodylength is set

This commit is contained in:
Dolf Schimmel (Freeaqingme)
2016-07-19 21:54:06 +02:00
parent f535e4ea6f
commit 9892e025c8
3 changed files with 9 additions and 11 deletions

View File

@@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"fmt"
"github.com/stretchr/testify/assert"
)
const (
@@ -338,6 +338,11 @@ func Test_Sign(t *testing.T) {
emailSimple, err = dkim.Sign(emailSimple, options)
assert.Equal(t, signedSimpleSimpleLength, string(emailSimple))
// options.BodyLength is way larger than email body
options.BodyLength = 50000
emailRelaxed = append([]byte(nil), email...)
emailRelaxed, err = dkim.Sign(emailRelaxed, options)
assert.NoError(t, err)
}
func Test_Verify(t *testing.T) {
@@ -456,8 +461,6 @@ func TestYahooIncDKIM(t *testing.T) {
dkim.lookupTXT = func(string) ([]string, error) {
return []string{"v=DKIM1; g=*; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDGDd1Fz/AblN4d1haW+4B/u8PXkpd/s/JFkCPqp0Zk8xZ/SEs15fsWmj7yZwfsgi04Bs1eJhUIGf0iufHvkK5ws5XKBfbw1hYBHexopqYT5JFERYJ3slNEG5EeB04kKWpECjoMkXhDWvUJrHaBqGAz2KQ1dKAzrtKqRN2IVcDbBQIDAQAB"}, nil
}
//dkim.now = func() time.Time { return time.Unix(1439925628, 0) }
//_, err := dkim.Verify([]byte(yahooIncDKIMtest), yIncTXT, yIncTime)
_, err := dkim.Verify([]byte(yahooIncDKIMtest))
if err != nil {
t.Fatal(err)