Skip to content

Instantly share code, notes, and snippets.

@j16r
Created June 25, 2015 15:05
Show Gist options
  • Save j16r/ac274feb99780bac85f5 to your computer and use it in GitHub Desktop.
Save j16r/ac274feb99780bac85f5 to your computer and use it in GitHub Desktop.
Golang and ParseECPrivateKey
# According to the go src (https://github.com/golang/go/blob/master/src/crypto/x509/sec1_test.go)
# this is how to use openssl to generate an EC private key. Go can't read it
# however.
# openssl ecparam -name secp521r1 -genkey -param_enc explicit -outform PEM -out $@
# e.g:
got asn1: structure error: tags don't match (6 vs {class:0 tag:16 length:450 isCompound:true}) {optional:false ex
plicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 set:false omitEmpty:false} ObjectIdentifier @4
# For debugging the private key
# openssl ecparam -in $@ -text -noout
@joseche
Copy link

joseche commented Nov 11, 2015

I am having a similar problem, certificates generated with Go can be parsed by openssl but not by Go's x509.ParseCertificate func.
Did you find a solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment