mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-21 17:56:19 +08:00
pkcs7: test clean
This commit is contained in:
parent
a93f7fd94d
commit
c1289f7224
@ -8,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/big"
|
||||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
@ -151,7 +150,7 @@ func TestUnmarshalSignedAttribute(t *testing.T) {
|
||||
oidTest := asn1.ObjectIdentifier{2, 3, 4, 5, 6, 7}
|
||||
testValue := "TestValue"
|
||||
if err := toBeSigned.AddSigner(cert.Certificate, *cert.PrivateKey, SignerInfoConfig{
|
||||
ExtraSignedAttributes: []Attribute{Attribute{Type: oidTest, Value: testValue}},
|
||||
ExtraSignedAttributes: []Attribute{{Type: oidTest, Value: testValue}},
|
||||
}); err != nil {
|
||||
t.Fatalf("Cannot add signer: %s", err)
|
||||
}
|
||||
@ -257,12 +256,4 @@ func testOpenSSLParse(t *testing.T, certBytes []byte) {
|
||||
if err := tmpCertFile.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
func fromHex(s string) *big.Int {
|
||||
result, ok := new(big.Int).SetString(s, 16)
|
||||
if !ok {
|
||||
panic(s)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
@ -254,12 +254,16 @@ func TestVerifyFirefoxAddon(t *testing.T) {
|
||||
t.Errorf("Verify failed with error: %v", err)
|
||||
}
|
||||
|
||||
// fake content
|
||||
p7.Content = []byte("bad content")
|
||||
if err = p7.VerifyWithChain(certPool); err == nil {
|
||||
t.Errorf("Verify with incorrect content did not error")
|
||||
}
|
||||
p7.Content = FirefoxAddonContent
|
||||
|
||||
if p7.GetOnlySigner() == nil {
|
||||
t.Errorf("no only signer")
|
||||
}
|
||||
// The chain has validity:
|
||||
//
|
||||
// EE: 2016-08-17 20:04:58 +0000 UTC 2021-08-16 20:04:58 +0000 UTC
|
||||
|
Loading…
x
Reference in New Issue
Block a user