-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: ParseCertificate should error on invalid tag for PolicyMappings #70074
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
Comments
1.18 isn't a supported release, does this reproduce on a supported version? |
I reproduced this problem in go version go1.23.2 linux/amd64 |
See #68484, right now Go has no support for PolicyMappings so it just ignores it (unless it's marked critical). |
According to your reply, I tested it again with the wrong tag PolicyMappings marked as critical. |
I noticed that you closed this issue before I responded, but I thought it was a feature request, so I responded again in the closed issue after retesting. |
the issue I linked is the feature request to implement it. |
Go version
go version go1.18.1 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Use x509.ParseCertificate to parse the der certificate.
What did you see happen?
For my test case, I changed the correct aki extension to the wrong tag (30—>39). The parsing result was an invalid authority key identifier error. However, the same modification to the PolicyMappings extension (30—>35) did not throw the same error.
What did you expect to see?
RFC5280 stipulates that both extensions are SEQUENCE sequences, which are encoded as 30 under ASN1 rules. I provide my test case in the attachment (the unmodified tag is named 1, and the modified tag is named 2)
Test Cases.zip
The text was updated successfully, but these errors were encountered: