Open eastdevil opened 2 years ago
Hi,
The below code
prv, err := ecdsa.GenerateKey(ecc.P256k1(), rand.Reader)
if err != nil {
return err
}
prvX509, err := x509.MarshalECPrivateKey(prv)
if err != nil {
return err
}
prvPem := pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: prvX509})
fmt.Println(string(prvPem))
gives the x509: unknown elliptic curve
error.
How the P256k1 keys can be written to and read from PEM files in the X509 encoding format?
Thank you!
Would love to be able to output the keys into PEM files.