|
|
|
@ -10,25 +10,6 @@ import (
|
|
|
|
|
"math/big"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Example for self-signed certificates by openssl:
|
|
|
|
|
|
|
|
|
|
Self CA:
|
|
|
|
|
openssl genrsa -out ca.key 2048
|
|
|
|
|
openssl req -x509 -new -nodes -key ca.key -subj "/CN=example.ca.com" -days 5000 -out ca.crt
|
|
|
|
|
|
|
|
|
|
Server:
|
|
|
|
|
openssl genrsa -out server.key 2048
|
|
|
|
|
openssl req -new -key server.key -subj "/CN=example.server.com" -out server.csr
|
|
|
|
|
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 5000
|
|
|
|
|
|
|
|
|
|
Client:
|
|
|
|
|
openssl genrsa -out client.key 2048
|
|
|
|
|
openssl req -new -key client.key -subj "/CN=example.client.com" -out client.csr
|
|
|
|
|
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 5000
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
func newCustomTLSKeyPair(certfile, keyfile string) (*tls.Certificate, error) {
|
|
|
|
|
tlsCert, err := tls.LoadX509KeyPair(certfile, keyfile)
|
|
|
|
|
if err != nil {
|
|
|
|
|