Skip to content

spetrovic77/tls-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages