Skip to content
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

Predefined error value for unexpected number of safe bags #41

Open
piusalfred opened this issue Dec 2, 2022 · 0 comments
Open

Predefined error value for unexpected number of safe bags #41

piusalfred opened this issue Dec 2, 2022 · 0 comments
Labels

Comments

@piusalfred
Copy link

piusalfred commented Dec 2, 2022

I have been working on a project where this error is significant

err = errors.New("pkcs12: expected exactly two safe bags in the PFX PDU")

Can we create a predefined error value for this?. It makes it easy for error value comparison. I suggest something like this

var ErrExpectedTwoSafeBags error = errors.New("pkcs12: expected exactly two safe bags in the PFX PDU")

So We can do something like this

pfx, cert, err := pkcs12.Decode(pfxData, password)
if errors.Is(err,pkcs12.ErrExpectedTwoSafeBags){
    // LoadChain
}

instead of

if err.Error() == "pkcs12: expected exactly two safe bags in the PFX PDU" {
}
@AGWA AGWA added the feature label Jul 15, 2023
@AGWA AGWA changed the title create a predefined error value Predefined error value for unexpected number of safe bags Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants