From bd318be0434a57050ed475e0f45c3dbb16c09c2e Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Tue, 5 Nov 2019 07:52:03 -0800 Subject: [PATCH] pkcs12: fix dropped error This fixes a dropped error in Decode(). Change-Id: Iae5cac72f63a80dd5230034a3cfe1d6e76cc3415 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/205421 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- pkcs12/pkcs12.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkcs12/pkcs12.go b/pkcs12/pkcs12.go index 55f7691..3e2ce69 100644 --- a/pkcs12/pkcs12.go +++ b/pkcs12/pkcs12.go @@ -252,6 +252,7 @@ func Decode(pfxData []byte, password string) (privateKey interface{}, certificat case bag.Id.Equal(oidPKCS8ShroundedKeyBag): if privateKey != nil { err = errors.New("pkcs12: expected exactly one key bag") + return nil, nil, err } if privateKey, err = decodePkcs8ShroudedKeyBag(bag.Value.Bytes, encodedPassword); err != nil {