Setting up the certificate for testing ListenAndServeTLS

268 views
Skip to first unread message

C K Kashyap

unread,
May 30, 2013, 12:52:33 AM5/30/13
to golang-nuts
Hi,

I am working on building a windows 8 app that needs to talk to some REST services. To ease my development, I want to develop a dummy server that responds just like the original server but with customizable delays etc. I want to use go for this - Its amazing how easily I could cook up the server facade :) However, I am struggling to get the certificate thing right. I could create the certificate alright but I cannot seem to make windows accept it as trusted. I even imported the certificate into the trusted roots but no luck.

I am aware that this is not really "go" stuff but I hope that someone on this list may have solved this problem recently.

Regards,
Kashyap

Dave Cheney

unread,
May 30, 2013, 1:01:37 AM5/30/13
to C K Kashyap, golang-nuts
If you are using a mock http server, why do you need to use TLS ? Can
you just talk to your mock over plain old HTTP ?
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

C K Kashyap

unread,
May 30, 2013, 1:04:26 AM5/30/13
to Dave Cheney, golang-nuts
I should've mentioned this - there are some oauth components that I am using as a black box that has "https" inside them and I cannnot modify it.

Regards,
Kashyap

Mathieu Lonjaret

unread,
May 30, 2013, 10:22:53 AM5/30/13
to C K Kashyap, Dave Cheney, golang-nuts
If you add your cert to the RootCAs, you need to make sure the cert
you've created is indeed a CA itself. afaik, you need fields such as:

KeyUsage: x509.KeyUsageKeyEncipherment |
x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
IsCA: true,
BasicConstraintsValid: true,

also, if the client side is in Go too you could run the client side
with InsecureSkipVerify set in the config
(http://golang.org/pkg/crypto/tls/#Config).
Reply all
Reply to author
Forward
0 new messages