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

x/crypto/pkcs12: unknown digest algorithm 2.16.840.1.101.3.4.2.1 #62375

Open
mindcrackx opened this issue Aug 30, 2023 · 2 comments
Open

x/crypto/pkcs12: unknown digest algorithm 2.16.840.1.101.3.4.2.1 #62375

mindcrackx opened this issue Aug 30, 2023 · 2 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mindcrackx
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.21.0 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
Can provide if necessary, but can't copy-paste right now.
Relevant Info should be in `go version`?

What did you do?

package main

import (
    "os"

    "golang.org/x/crypto/pkcs12" // version 0.12.0 (latest as of time of writing)
)

func main() {
    pfxData, err := os.ReadFile("./path/to/my/pfx")
    if err != nil {
        panic(err)
    }

    _, err := pkcs12.ToPEM(pfxData, "my-password")
    if err != nil {
        panic(err)  // <- error here
    }
}

What did you expect to see?

successfully getting the pem blocks

What did you see instead?

panic: pkcs12: unknown digest algorithm: 2.16.840.1.101.3.4.2.1

It seems like x/crypto does not support the algorithms defined in https://oidref.com/2.16.840.1.101.3.4.2.1
In x/crypto/pkcs12/mac.go verifyMac it expects the macData.Mac.Algorithm.Algorithm to be 1.3.14.3.2.26
and thus errors with "unknown digest algorithm".

verifyMac

@gopherbot gopherbot added this to the Unreleased milestone Aug 30, 2023
@seankhliao seankhliao changed the title x/crypto: pkcs12: unknown digest algorithm x/crypto/pkcs12: unknown digest algorithm Aug 30, 2023
@seankhliao seankhliao changed the title x/crypto/pkcs12: unknown digest algorithm x/crypto/pkcs12: unknown digest algorithm 2.16.840.1.101.3.4.2.1 Aug 30, 2023
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 31, 2023
@dmitshur
Copy link
Contributor

CC @golang/security.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants
@dmitshur @gopherbot @mindcrackx and others