-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/x509: unexpected handling of escape characters #73028
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
In the issue report you mention "I use Go to parse this CRL file, Go interprets". Can you please provide a snippet of code for that? In particular, that code will help determine if the problem is in the crypto/x509 package, or how it's being used. Please see https://go.dev/wiki/Questions for asking questions about Go. |
|
Thanks. The value of
And the String method prints that one backslash in escaped format. Here's a smaller repro: package main
import (
"crypto/x509/pkix"
"fmt"
)
func main() {
name := pkix.Name{Organization: []string{`abc\`}}
fmt.Println(name)
// Output: O=abc\\
} (https://go.dev/play/p/TULVLleyOCY) CC @golang/security. |
|
see https://www.rfc-editor.org/rfc/rfc2253#section-2.4 I believe this this working as intended. |
Thank you for your reply. |
Go version
go version go1.24.1 linux/amd64
Output of
go env
in your module/workspace:CN=test,OU=Class 3 Public Primary Certification Authority,O=VeriSign\\,L=test,ST=test,C=US 2025-01-01 00:00:00 +0000 UTC 2025-12-01 00:00:00 +0000 UTC 1
What did you do?
Hello Developer: I have a CRL file, and the "O" field in its issuer section contains an escape character. The value of the "O" field is 'VeriSign\'. When I use Go to parse this CRL file, Go interprets the "O" field as 'VeriSign\\'. However, when I open the CRL file as a .crl file, the "O" field in the issuer section shows as 'VeriSign\'. Therefore, I suspect that the handling of the escape character '\\' by Go may not be entirely reasonable.
What did you see happen?
The issuer field is parsed as Issuer: CN=test,OU=Class 3 Public Primary Certification Authority,O=VeriSign\\,L=test,ST=test,C=US
.
What did you expect to see?
crl_file_.zip
The text was updated successfully, but these errors were encountered: