Giter VIP home page Giter VIP logo

asio_sodium_socket's Introduction

Build Status

This is a header-only C++14 library implementing custom transport encryption using libsodium and Asio's stackless coroutines. It assumes pre-shared public keys and uses only the sealed box and crypto box constructs.

Usage

This library depends on Asio, libsodium, Microsoft's Guideline Support Library, and the reference implementation for std::experimental::optional. Aside from libsodium, these dependencies are bundled as submodules in the bundle directory. To use this library, just add the appropriate bundled include directories to your project along with the primary include directory. You will also need to install and link against libsodium.

For a usage example, see the socket test. Note that this library only supports in-order transports (e.g. tcp or domain sockets).

Tests

The project is currently built using the Chromium project's Generate Ninja. There is a PKGBUILD for Arch Linux here. You will also need to install the Ninja build system.

To build and run the tests:

gn gen out/release --args="is_debug=false"
ninja -C out/release

The default build uses clang. To use gcc:

gn gen out/release --args="is_debug=false compiler=\"gcc\""
ninja -C out/release

Authentication

Using the server's public key, the client sends a fixed-length sealed box containing the client's public key and a random reply nonce. If the public key retrieved from the sealed box is unknown, the connection is terminated.

The server uses the reply nonce to respond with a crypto box containing a reply nonce and a followup nonce. The reply nonce is used for the client's next transmission, and the followup nonce is used for the server's next transmission.

Communication

Subsequent messages consist of a fixed-length message header followed by variable-length message data. A message header contains the length of the following message data along with the random data nonce used to encrypt the message data and a random followup nonce that will be used to encrypt the next message header. The message length is sent in little-endian format.

Notes

With a bit of work, keys could be ratcheted with each transmission.

asio_sodium_socket's People

Contributors

mikezackles avatar

Watchers

 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.