crypto/rsa: verification error

2,117 views
Skip to first unread message

Frank Schröder

unread,
Apr 24, 2016, 4:29:12 PM4/24/16
to golang-nuts
Hi Gophers,

I am trying to create a TLS certificate for a test HTTPS server and use that cert in a subsequent request. I've copied the code for making the certificate from crypto/tls/generate_cert.go and think I'm doing the right thing when creating the server or making the request but I am getting the following error:

   x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate

It works - obviously - when I set InsecureSkipVerify to true in the client but that disables the certificate verification.

I've created a sample app on the playground:

http://play.golang.org/p/y6L6BD6A0n

Any idea what I'm doing wrong?

Thx
Frank

Frank Schröder

unread,
Apr 25, 2016, 4:25:07 PM4/25/16
to golang-nuts
It turned out that it had nothing to do with the certificate but with the fact that the httptest Server stores its startup TLS configuration in Server.TLS instead of Server.Config.TLSConfig. I'm sure there is a reason for this but this was unexpected.

Frank
Reply all
Reply to author
Forward
0 new messages