|
@@ -8,11 +8,12 @@ import (
|
|
|
"bytes"
|
|
"bytes"
|
|
|
_ "crypto/sha512"
|
|
_ "crypto/sha512"
|
|
|
"encoding/hex"
|
|
"encoding/hex"
|
|
|
- "golang.org/x/crypto/openpgp/errors"
|
|
|
|
|
"io"
|
|
"io"
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
"strings"
|
|
"strings"
|
|
|
"testing"
|
|
"testing"
|
|
|
|
|
+
|
|
|
|
|
+ "golang.org/x/crypto/openpgp/errors"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func readerFromHex(s string) io.Reader {
|
|
func readerFromHex(s string) io.Reader {
|
|
@@ -368,6 +369,29 @@ func TestNoArmoredData(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func TestIssue11503(t *testing.T) {
|
|
|
|
|
+ data := "8c040402000aa430aa8228b9248b01fc899a91197130303030"
|
|
|
|
|
+
|
|
|
|
|
+ buf, err := hex.DecodeString(data)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ t.Errorf("hex.DecodeSting(): %v", err)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ kr, err := ReadKeyRing(new(bytes.Buffer))
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ t.Errorf("ReadKeyring(): %v", err)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ _, err = ReadMessage(bytes.NewBuffer(buf), kr,
|
|
|
|
|
+ func([]Key, bool) ([]byte, error) {
|
|
|
|
|
+ return []byte("insecure"), nil
|
|
|
|
|
+ }, nil)
|
|
|
|
|
+
|
|
|
|
|
+ if err == nil {
|
|
|
|
|
+ t.Errorf("ReadMessage(): Unexpected nil error")
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const testKey1KeyId = 0xA34D7E18C20C31BB
|
|
const testKey1KeyId = 0xA34D7E18C20C31BB
|
|
|
const testKey3KeyId = 0x338934250CCC0360
|
|
const testKey3KeyId = 0x338934250CCC0360
|
|
|
|
|
|