Giter VIP home page Giter VIP logo

boost-wintls's Introduction

Boost.Wintls Logo

Native Windows TLS stream for Boost.Asio

wintls.dev

Build Coverage Coverity Analysis
Build status Codecov Coverity Scan Build Status

Contents

Introduction

Implements a TLS stream wrapper for use with Boost.Asio similar to Boost.Asio.SSL but using native Windows API (SSPI/Schannel) functionality instead of OpenSSL for providing TLS encrypted stream functionality.

Requirements

As this library uses Windows specific libraries, it is only supported on Microsoft Windows although it is intended to be used alongside the existing Boost.Asio.SSL implementation.

Boost is required. Currently tested with Boost 1.72, but at least newer versions ought to work as well.

A working C++ compiler supporting the C++14 standard is required. Currently tested compilers are:

  • MSVC for Visual Studio 2019
  • MSVC for Visual Studio 2017
  • Clang
  • MinGW64 (GCC)

Only 64 bit builds have been tested.

Building

Boost.Wintls is header-only. To use it just add the necessary #include line to your source files, like this:

#include <boost/wintls.hpp>

CMake may be used to generate a Visual Studio solution for building the tests and examples, e.g.:

mkdir build
cd build
cmake ..
cmake --build .

Quickstart

Similar to Boost.Asio.SSL a boost::wintls::context is required to hold certificates and options to use for the TLS stream:

    // Set up context to use the systems default TLS methods (e.g. TLS 1.2)
    boost::wintls::context ctx{boost::wintls::method::system_default};

Using that context a boost::wintls::stream can be constructed using a boost::asio::io_context specifying the underlying stream type (most often a TCP stream):

    boost::asio::io_context ioc;

    boost::wintls::stream<boost::asio::ip::tcp::socket> stream(ioc, ctx);

Although that is all that is required to construct a stream that fully supports the standard boost::asio stream operations like write or async_read the underlying stream probably needs to be connected, a handshake has to be performed and most likely, certificates and keys has to be handled as well.

For details on how to do that, please see the documentation and the examples

Documentation

Documentation is available here.

Contributing

Pull requests, issue reporting etc. are very much welcome.

Also, if you use this library and find it useful, I would love to know.

Thanks

  • Vinnie Falco For encouraging me to write this library in the first place as well as code reviews and other useful input.
  • Richard Hodges For code reviews and other useful input.
  • Damian Jarek For code reviews and other useful input.
  • Marcelo Zimbres For coming up with the short and descriptive name for this library

boost-wintls's People

Contributors

laudrup 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.