TLS with selfsigned certificate

前端 未结 6 2019
再見小時候
再見小時候 2020-12-07 17:10

I\'m trying to establish a TLS connection with the use of a self signed server certificate.

I generated the certificate with this example code: http://golang.org/src

6条回答
  •  北海茫月
    2020-12-07 17:43

    The problem is that you need a CA certificate in the server-side config, and this CA must have signed the server's certificate.

    I have written some Go code that will generate a CA certificate, but it hasn't been reviewed by anyone and is mostly a toy for playing around with client certs. The safest bet is probably to use openssl ca to generate and sign the certificate. The basic steps will be:

    1. Generate a CA Certificate
    2. Generate a Server key
    3. Sign the Server key with the CA certificate
    4. Add the CA Certificate to the client's tls.Config RootCAs
    5. Set up the server's tls.Config with the Server key and signed certificate.

提交回复
热议问题