-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: error parsing even large ASN.1 identifiers #58821
Comments
CC @golang/security. |
From https://go-review.googlesource.com/c/crypto/+/365674 done for #49678 it follows that int element can not be greater than 2^31-1. |
It should be possible to support larger than 2^31 values on the platforms where sizeof(int) > 32 (https://pkg.go.dev/encoding/asn1#ObjectIdentifier is defined as []int) similar to Marshal that supports values up to maxInt. |
Right, we make a conscious choice to limit to the lower of the two possibilities so that there aren't certificates (or other ASN1 based protocols) which only work on 64 bit platforms. |
We also run into the same issue with a user trying to parse a certificate from a Windows CA. Do you think it would be possible to add a |
When you say "Windows CA" do you mean a CA managed by Microsoft? Do you happen to know what the offending OID is? |
This comment was marked as off-topic.
This comment was marked as off-topic.
asn1.ObjectIdentifier is a slice of ints and asn1.Marshal can serialize int values greater than 2^31-1 on 64 bit platforms. This change updates ReadASN1ObjectIdentifier to support greater int values on 64 bit platforms. For golang/go#58821
I've created a fix in case this decision changes |
Thanks @AlexanderYastrebov for the effort. I hope to reconsider the decision of |
@rolandshoemaker I linked the issue we have open in Telegraf influxdata/telegraf#12684. Citing @skinfrakkiirid:
he also provided the policy section of the cert
|
Unfortunately, this solution won't support the 128 bit long 2.25 OID subtree (as mentioned in #30757) so you would end up with a bit more certificates working on 64 bit architecture but not all certificates. I think this deserves a real solution where all certificates are supported by Go. It's really sad that a 4 years old issue has still no clear solution forward. Also I don't understand why #39795 has been closed. |
#60665 suggests a path forward on this. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes on
go 1.20.1
.Similar to #49678 but with an even larger oid: https://oidref.com/1.2.36.20151795998
This caused our program failure to parse a customer's certificate. Error message:
x509: invalid certificate policies
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://go.dev/play/p/u4NrlO1xGqr
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: