Skip to content
Client/Server Secure ConnectionProvider for oatpp applications. Based on MbedTLS.
Branch: master
Clone or download
lganzzzo Merge pull request #2 from david-novak-legrand/compat-explicit-casts
Use explicit cast so that iOS will build
Latest commit 9d80fff Jun 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake draft of oatpp-mbedtls module May 24, 2019
src Use explicit cast so that iOS will build Jun 11, 2019
test Updated to latest oatpp APIs May 26, 2019
utility fix CI scripts May 25, 2019
.gitignore setting up CI May 25, 2019
CMakeLists.txt fix build scripts May 25, 2019
LICENSE Initial commit May 24, 2019
README.md Update README.md Jun 9, 2019
azure-pipelines.yml Add MacOS build to azure-pipelines May 25, 2019

README.md

oatpp-mbedtls Build Status

oatpp-mbedtls - extension for Oat++ Web Framework.
It provides secure server and client connection providers for oatpp applications. Based on MbedTLS.
Supports both "Simple" and "Async" oatpp APIs.

See more:

How To Build

Requires

  • MbedTLS installed.

Install MbedTLS from source

git clone -b 'mbedtls-2.16.1' --single-branch --depth 1 --recurse-submodules https://github.com/ARMmbed/mbedtls

cd mbedtls
mkdir build && cd build

cmake ..
make install

Install MbedTLS to a custom location

git clone -b 'mbedtls-2.16.1' --single-branch --depth 1 --recurse-submodules https://github.com/ARMmbed/mbedtls

cd mbedtls
mkdir build && cd build

cmake -DCMAKE_INSTALL_PREFIX:PATH=/my/custom/location ..
make install

Build And Install oatpp-mbedtls

If mbedtls was installed to a standard location:

mkdir build && cd build
cmake ..
make install

If mbedtls was installed to a custom location:

mkdir build && cd build
cmake -DMBEDTLS_ROOT_DIR=/my/custom/location ..
make install

APIs

Server

ConnectionProvider

Create ConnectionProvider

const char* serverCertificateFile = "path/to/server/certificate";
const char* serverPrivateKeyFile = "path/to/server/private/key";

/* Create Config */
auto config = oatpp::mbedtls::Config::createDefaultServerConfigShared(serverCertificateFile, serverPrivateKeyFile);

/* Create Secure Connection Provider */
auto connectionProvider = oatpp::mbedtls::server::ConnectionProvider::createShared(config, 443 /* port */);

/* Get Secure Connection Stream */
auto connection = connectionProvider->getConnection();

Custom Transport Stream

Create ConnectionProvider with custom transport stream.

const char* serverCertificateFile = "path/to/server/certificate";
const char* serverPrivateKeyFile = "path/to/server/private/key";

/* Create Config */
auto config = oatpp::mbedtls::Config::createDefaultServerConfigShared(serverCertificateFile, serverPrivateKeyFile);

/* Create Transport Stream Provider */
/* Replace With Your Custom Transport Stream Provider */
auto transportStreamProvider = oatpp::network::server::SimpleTCPConnectionProvider::createShared(443 /* port */);

/* Create Secure Connection Provider */
auto connectionProvider = oatpp::mbedtls::server::ConnectionProvider::createShared(config, transportStreamProvider);

/* Get Secure Connection Stream over Custom Transport Stream */
auto connection = connectionProvider->getConnection();

Note: To use oatpp-mbedtls for server connections with custom transport stream you should implement:

Client

ConnectionProvider

Create ConnectionProvider

/* Create Config */
auto config = oatpp::mbedtls::Config::createDefaultClientConfigShared();

/* Create Secure Connection Provider */
auto connectionProvider = oatpp::mbedtls::client::ConnectionProvider::createShared(config, "httpbin.org", 443 /* port */);

/* Get Secure Connection Stream */
auto connection = connectionProvider->getConnection();

Custom Transport Stream

Create ConnectionProvider with custom transport stream.

/* Create Config */
auto config = oatpp::mbedtls::Config::createDefaultClientConfigShared();

/* Create Transport Stream Provider */
/* Replace With Your Custom Transport Stream Provider */
auto transportStreamProvider = oatpp::network::client::SimpleTCPConnectionProvider::createShared("httpbin.org", 443 /* port */);

/* Create Secure Connection Provider */
auto connectionProvider = oatpp::mbedtls::client::ConnectionProvider::createShared(config, transportStreamProvider);

/* Get Secure Connection Stream over Custom Transport Stream */
auto connection = connectionProvider->getConnection();

Note: To use oatpp-mbedtls for client connections with custom transport stream you should implement:

See more

You can’t perform that action at this time.