Re: [go-nuts] Load public key from DER encoded certificate

2017-03-06 Thread Janne Snabb
You are trying to read a certificate with a function intended for reading a public key. Use x509.ParseCertificates instead. Janne Snabb sn...@epipe.com On 2017-03-06 16:39, 0x7bc77a wrote: > Hi, > > I would like to load the public key from a DER encoded certificate > > Here is my code > > fu

[go-nuts] Load public key from DER encoded certificate

2017-03-06 Thread 0x7bc77a
Hi, I would like to load the public key from a DER encoded certificate Here is my code func ExampleParsePKIXPublicKey() { raw, err := ioutil.ReadFile("/Path/To/DER/Encoded/Certificate") if err != nil { panic("failed to read certificate" + err.Error()) } pub, err := x509.ParsePKIXPublicKey(raw)