We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
遇到过一个go库解析pfx文件得到的私钥并转化为PEM格式,和openssl解析同一个pfx文件产生的PEM格式的私钥里的公钥不一样,并且这个私钥用gmx509.ReadPrivateKeyFromPem(priKeyPem, nil)读取失败,go库解析示例如下:
`//解析pfx证书 _, priKey, err := gmpkcs12.SM2P12Decrypt(gmPfxFile, "123456") if err != nil { fmt.Println("decrypt gm pfx error", err) return }
priPem, err := gmx509.WritePrivateKeyToPem(priKey, nil) if err != nil { fmt.Println("write sm2 pri key to pem error", err) return } fmt.Println("priPem:", string(priPem)) //将私钥转换成PEM格式字符串 priKeyBytes, err := gmpkcs12.MarshalECPrivateKey(priKey) if err != nil { fmt.Println("marshal ec pri key error", err) return } priKeyPem := pem.EncodeToMemory(&pem.Block{ Type: "EC PRIVATE KET", Bytes: priKeyBytes, }) log.Println("priKeyPem:", string(priKeyPem)) _, err = gmx509.ReadPrivateKeyFromPem(priKeyPem, nil) if err != nil { fmt.Println("read error") } else { fmt.Println("read success") }`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
遇到过一个go库解析pfx文件得到的私钥并转化为PEM格式,和openssl解析同一个pfx文件产生的PEM格式的私钥里的公钥不一样,并且这个私钥用gmx509.ReadPrivateKeyFromPem(priKeyPem, nil)读取失败,go库解析示例如下:
`//解析pfx证书
_, priKey, err := gmpkcs12.SM2P12Decrypt(gmPfxFile, "123456")
if err != nil {
fmt.Println("decrypt gm pfx error", err)
return
}
The text was updated successfully, but these errors were encountered: