tls-demo

command module
v0.0.0-...-1d686dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

mTLS authentication example

A simple demonstration of using CA-signed certificates to implement mTLS in Go.

Running instructions

  1. Clone the repository.

  2. Start the server in the terminal.

$ go run . --server

  1. Start the client in a different terminal.

$ go run .

Key re-generation

  1. Generate CA private key, use the password "foo".

openssl genrsa -des3 -out ca.key 2048

  1. Generate the root public key:

openssl req -x509 -new -nodes -key ca.key -sha256 -days 1825 -out ca.pem

  1. Generate client private key:

openssl genrsa -out client.key 2048

  1. Generate the client certificate service request.

openssl req -new -key client.key -out client.csr

  1. Generate the client certificate. Use the CA password "foo".

openssl x509 -req -in client.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out client.crt -days 825 -sha256 -extfile tls.ext

  1. Generate server private key:

openssl genrsa -out server.key 2048

  1. Generate the server certificate service request.

openssl req -new -key server.key -out server.csr

  1. Generate the server certificate. Use the CA password "foo".

openssl req -x509 -new -CA ca.pem -CAkey ca.key -CAcreateserial -key server.key -out server.crt -days 825 -sha256

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL