-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: ParseCertificate fails with "net/url: invalid userinfo" #69930
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
This seems to happen here: Lines 389 to 397 in 6853d89
And the URL seems to be invalid, see simpler reproducer https://go.dev/play/p/IMYvwnRjF7F CC @neild (as per https://dev.golang.org/owners for net/url) not sure how to judge that URL. I guess |
See https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.6
The other tools may be for more general x509 usage, crypto/x509 targets the Web PKI where URIs are more restricted. |
Go version
go version go1.18.1 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Use cert, err := x509.ParseCertificate(derBytes) to process the certificate
What did you see happen?
Error message:cannot parse URI "https://1kYj\\[@.cfZGv3T_Tr.D?/zrm3/4WA/Ir}BQ/yR]/0[g?<tX=uR?&K'O={d2}&sG?rLi=<}e>": parse "https://1kYj\\[@.cfZGv3T_Tr.D?/zrm3/4WA/Ir}BQ/yR]/0[g?<tX=uR?&K'O={d2}&sG?rLi=<}e>": net/url: invalid userinfo
What did you expect to see?
The results are different from Openssl and Gnutls. Openssl's openssl x509 -noout -text -in filename and gnutls's certtool -i --infile=filename --inraw successfully viewed the certificate.Both successfully resolved SAN


The text was updated successfully, but these errors were encountered: