fix verify_test on go1.16
DSAWithSHA1 removed from crypto/x509 in go1.16, check for unsupported error
This commit is contained in:
Родитель
5921d95194
Коммит
9676f6c2aa
1
go.mod
1
go.mod
|
@ -5,4 +5,5 @@ go 1.12
|
|||
require (
|
||||
github.com/github/fakeca v0.1.0
|
||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -7,3 +7,5 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
|||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/github/ietf-cms/protocol"
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
func ExampleSignedData() {
|
||||
|
@ -203,7 +204,6 @@ func TestVerifyChain(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestVerifyDSAWithSHA1(t *testing.T) {
|
||||
|
||||
// Created with the following openssl commands:
|
||||
// openssl dsaparam -out dsakey.pem -genkey 1024
|
||||
// openssl req -key dsakey.pem -new -x509 -days 365000 -out dsa.crt -sha1 -subj "/CN=foo.com"
|
||||
|
@ -272,6 +272,9 @@ F1Al5pA+giJh15T7Uu+p5O0J
|
|||
sd.SetCertificates(pkcs7Certs)
|
||||
_, err = sd.Verify(pkcs7VerifyOptions)
|
||||
if err != nil {
|
||||
if xerrors.Is(err, x509.ErrUnsupportedAlgorithm) {
|
||||
return
|
||||
}
|
||||
t.Fatalf("Error verifying signing request: %v, err %v", *sd, err)
|
||||
}
|
||||
data, err := sd.GetData()
|
||||
|
|
Загрузка…
Ссылка в новой задаче