Coder Social home page Coder Social logo

tls-demo's Introduction

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

tls-demo's People

Contributors

spetrovic77 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

giautm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.