Coder Social home page Coder Social logo

ycdng / howto-openssl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mdaxini/howto-openssl

0.0 0.0 0.0 184 KB

How to secure connections between two endpoints using OpenSSL, and how to choose the protocol and ciphers to achieve optimal security and performance for a specific use case.

License: Apache License 2.0

C 96.49% Makefile 3.51%

howto-openssl's Introduction

howto-openssl

This is an example of creating a server and a client that communicate over TLS 1.2 with cipher TLS_RSA_WITH_AES_256_GCM_SHA384 (AES256-GCM-SHA384). It also demonstrates how to perform server side and client side certificate authentication and verification. In this example the certificate and the private key are shared by the server and the client. However, you can easily use a different certificate and key. The instructions for creating these are outlined below.

A detailed treatise on the technical choices made for this example, and more details about OpenSSL and some of its tooling can be found in the post in the wiki for this project.

===

Running the server and client

To compile, run from the directory with the Makefile:

make

To clean artifacts from compile, run from the directory with the Makefile:

make clean

Run the server (accepts connection on localhost:1112):

src/tls_server

Run the client (connects to server on localhost:1112:

src/tls_client

The server and the client use the server.crt and server.key from the src folder.

===

Testing the server and client independently

Testing the server

src/tls_server

openssl s_client -msg -verify -tls1_2  -state -showcerts -cert src/server.crt -key src/server.key -connect localhost:1112

Enter any text and hit enter, the server displays the client message and sends back "PONG".

The s_client command connects to the TLS 1.2 speaking server on localhost and port 1112 using the certificate server.crt and key server.key. It also validates the server certificate. It will display the handshake and certificate informaiton in detail.

Testing the client

openssl s_server -msg -verify -tls1_2 -state -cert src/server.crt -key src/server.key -accept 1112

src/tls_client

The client sends a PING to the server, and the server displays it.

===

Check out the wiki for more details.

===

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

howto-openssl's People

Contributors

mdaxini avatar

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.