Closed mimicode closed 19 hours ago
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Related Issues and Documentation
- crypto/x509: invalid certificate policies #65990 (closed)
- x/crypto: x509: invalid certificate policies #53773 (closed)
- crypto/x509: ParseCertificate fails with "net/url: invalid userinfo" #69930
- crypto/x509: unable to parse certificate parsable by Java #33259
- crypto/x509: cannot parse certificate IP & net/http cannot ignore this certificate error #65829 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
The situation I encountered is different.
This is expected as Go does not support SM algorithms. The certificate you posted uses SM2 and SM3. These are Chinese Standards for encryption.
See https://cran.r-project.org/web/packages/smcryptoR/smcryptoR.pdf
You can convert this issue into a proposal if you wish to add these algorithms to the standard library. Otherwise there are packages that implement these standards available, for example https://github.com/tjfoc/gmsm.
Duplicate of #54087
Go version
go version go1.22.6 windows/amd64
Output of
go env
in your module/workspace:What did you do?
https://go.dev/play/p/IWbLhFMHQz4?v=goprev
What did you see happen?
When extracting and parsing the certificate, the error message "x509: unsupported elliptic curve" is displayed.
What did you expect to see?
I can get the correct results when using openssl_x509_parse in PHP, but it does not work in Go.