C++ bindings for liboqs
liboqs-cpp is a header-only wrapper. The project contains the following files and folders:
doc: Doxygen-generated detailed documentation
kem.cpp: key encapsulation example
sig.cpp: signature example
include/oqs_cpp.h: main header file for the wrapper
unit_tests: unit tests written using Google Test (included)
To avoid namespace pollution, liboqs-cpp includes all of its code inside the namespace
oqs. All of liboqs pure C API is located
in the namespace
oqs::C, hence to use directly a C API function the user must qualify the call with
liboqs-cpp defines four main classes:
oqs::Signature, providing post-quantum key encapsulation and signture mechanisms, respectively, and
oqs::Sigs, containing only static member functions that provide information related to the available key encapsulation mechanisms or signature mechanism, respectively.
oqs::Signature must be instantiated with a string identifying one of mechanisms supported by liboqs; these can be enumerated using the
oqs::Sigs::get_enabled_sig_mechanisms() member functions.
The wrapper also defines a high resolution timing class,
The examples in the
examples folder are self-explanatory and provide more details about the wrapper's API.
liboqs-cpp depends on the liboqs C library; liboqs must be compiled as a Linux/macOS library or as a Windows DLL, and be visible to the wrapper, e.g. installed in a system-wide folder.
Compiling on UNIX-like platforms
To use the wrapper, the user must have access to a C++11 compliant compiler,
#include "oqs_cpp.h" in her/his program. The wrapper contains
a CMake build system for both examples and unit tests. To compile and run the examples, create a
build folder inside the root folder of the project, change
build, then type
cmake ..; make -j 4
The above commands build all examples in
the CMake build system is available on the user's platform.
-j 4 flag with your
processor's number of cores, e.g. use
-j 8 if your system has 8 cores.
To build only a specific example, e.g.
examples/kem, specify the target as the argument of the
make command, such as
To compile and run the unit tests, first
cd unit_tests, then create a
build folder inside
unit_tests, change directory to it, and finally type
cmake ..; make -j 4
The above commands build
tests/oqs_cpp_testing suite of unit tests.
liboqs-cpp has been extensively tested on Linux and macOS systems. Continuous integration is provided via Travis CI.
Compiling on Windows
A Visual Studio solution will be provided soon.
Limitations and security
liboqs is designed for prototyping and evaluating quantum-resistant cryptography. Security of proposed quantum-resistant algorithms may rapidly change as research advances, and may ultimately be completely insecure against either classical or quantum computers.
We believe that the NIST Post-Quantum Cryptography standardization project is currently the best avenue to identifying potentially quantum-resistant algorithms. liboqs does not intend to "pick winners", and we strongly recommend that applications and protocols rely on the outcomes of the NIST standardization project when deploying post-quantum cryptography.
We acknowledge that some parties may want to begin deploying post-quantum cryptography prior to the conclusion of the NIST standardization project. We strongly recommend that any attempts to do make use of so-called hybrid cryptography, in which post-quantum public-key algorithms are used alongside traditional public key algorithms (like RSA or elliptic curves) so that the solution is at least no less secure than existing traditional cryptography.
Just like liboqs, liboqs-cpp is provided "as is", without warranty of any kind. See LICENSE for the full disclaimer.
liboqs-cpp is licensed under the MIT License; see LICENSE for details.
liboqs-cpp was developed by Vlad Gheorghiu at evolutionQ and University of Waterloo.