Skip to content

Commit

Permalink
pkcs7: remove useless file
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Mar 9, 2023
1 parent d968b80 commit 9a839b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 188 deletions.
4 changes: 2 additions & 2 deletions pkcs7/sign_enveloped.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type signedEnvelopedData struct {
SignerInfos []signerInfo `asn1:"set"`
}

func (data signedEnvelopedData) GetRecipient(cert *smx509.Certificate) *recipientInfo {
func (data signedEnvelopedData) findRecipient(cert *smx509.Certificate) *recipientInfo {
for _, recp := range data.RecipientInfos {
if isCertMatchForIssuerAndSerial(cert, recp.IssuerAndSerialNumber) {
return &recp
Expand Down Expand Up @@ -93,7 +93,7 @@ func (p7 *PKCS7) DecryptAndVerify(cert *smx509.Certificate, pkey crypto.PrivateK
if !ok {
return nil, errors.New("pkcs7: it's NOT SignedAndEvelopedData")
}
recipient := sed.GetRecipient(cert)
recipient := sed.findRecipient(cert)
if recipient == nil {
return nil, errors.New("pkcs7: no enveloped recipient for provided certificate")
}
Expand Down
5 changes: 2 additions & 3 deletions pkcs7/sign_enveloped_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package pkcs7
import (
"bytes"
"encoding/pem"
"fmt"
"math/big"
"testing"

Expand Down Expand Up @@ -188,14 +187,14 @@ func TestCreateSignedEvnvelopedData(t *testing.T) {
t.Fatal(err)
}

fmt.Printf("%x\n", result)
// fmt.Printf("%x\n", result)

// parse, decrypt, verify
p7Data, err := Parse(result)
if err != nil {
t.Fatal(err)
}
encKeyBytes, err := p7Data.DecryptAndVerifyOnlyOne(*recipient.PrivateKey, func() error {
encKeyBytes, err := p7Data.DecryptAndVerify(recipient.Certificate, *recipient.PrivateKey, func() error {
return p7Data.Verify()
})
if err != nil {
Expand Down
183 changes: 0 additions & 183 deletions pkcs7/verify_test_dsa.go

This file was deleted.

0 comments on commit 9a839b5

Please sign in to comment.