Skip to content

x/crypto/pkcs12: ToPEM ignores getSafeContents error #19542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bronze1man opened this issue Mar 14, 2017 · 1 comment
Closed

x/crypto/pkcs12: ToPEM ignores getSafeContents error #19542

bronze1man opened this issue Mar 14, 2017 · 1 comment
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bronze1man
Copy link
Contributor

in file https://github.com/golang/crypto/blob/master/pkcs12/pkcs12.go#L110

func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) {
	encodedPassword, err := bmpString(password)
	if err != nil {
		return nil, ErrIncorrectPassword
	}

	bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword) // this error

	blocks := make([]*pem.Block, 0, len(bags))
	for _, bag := range bags {
		block, err := convertBag(&bag, encodedPassword)
		if err != nil {
			return nil, err
		}
		blocks = append(blocks, block)
	}

	return blocks, nil
}

I found that that err return from getSafeContents has been ignored.
I just found a p12 file that generated from mac keychain ToPEM return (nil,nil).
I tried to check that error. I got "pkcs12: expected exactly two items in the authenticated safe".

@ALTree ALTree added this to the Unreleased milestone Mar 14, 2017
@ALTree ALTree changed the title crypto/pkcs12: ignore error crypto/pkcs12: ToPEM ignores getSafeContents error Mar 14, 2017
@bradfitz bradfitz changed the title crypto/pkcs12: ToPEM ignores getSafeContents error x/crypto/pkcs12: ToPEM ignores getSafeContents error Mar 14, 2017
@bradfitz bradfitz added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Mar 14, 2017
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/38261 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 17, 2018
c-expert-zigbee pushed a commit to c-expert-zigbee/crypto_go that referenced this issue Mar 28, 2022
Fixes golang/go#19542

Change-Id: I60d2370d1d1e0763c72c9cc203ea2ff21123af73
Reviewed-on: https://go-review.googlesource.com/38261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
c-expert-zigbee pushed a commit to c-expert-zigbee/crypto_go that referenced this issue Mar 29, 2022
Fixes golang/go#19542

Change-Id: I60d2370d1d1e0763c72c9cc203ea2ff21123af73
Reviewed-on: https://go-review.googlesource.com/38261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LewiGoddard pushed a commit to LewiGoddard/crypto that referenced this issue Feb 16, 2023
Fixes golang/go#19542

Change-Id: I60d2370d1d1e0763c72c9cc203ea2ff21123af73
Reviewed-on: https://go-review.googlesource.com/38261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
BiiChris pushed a commit to BiiChris/crypto that referenced this issue Sep 15, 2023
Fixes golang/go#19542

Change-Id: I60d2370d1d1e0763c72c9cc203ea2ff21123af73
Reviewed-on: https://go-review.googlesource.com/38261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
desdeel2d0m added a commit to desdeel2d0m/crypto that referenced this issue Jul 1, 2024
Fixes golang/go#19542

Change-Id: I60d2370d1d1e0763c72c9cc203ea2ff21123af73
Reviewed-on: https://go-review.googlesource.com/38261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants