{"id":28462253,"url":"https://github.com/open-quantum-safe/liboqs-cpp","last_synced_at":"2025-07-03T16:31:34.042Z","repository":{"id":48799692,"uuid":"170719151","full_name":"open-quantum-safe/liboqs-cpp","owner":"open-quantum-safe","description":"C++ bindings for liboqs","archived":false,"fork":false,"pushed_at":"2025-06-06T16:47:33.000Z","size":12544,"stargazers_count":44,"open_issues_count":0,"forks_count":11,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-06-06T17:36:30.083Z","etag":null,"topics":["c-plus-plus","cpp","cpp11","cryptography","post-quantum-cryptography","quantum-computing"],"latest_commit_sha":null,"homepage":"https://openquantumsafe.org/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/open-quantum-safe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-14T16:07:12.000Z","updated_at":"2025-05-01T07:42:20.000Z","dependencies_parsed_at":"2023-01-20T13:17:08.532Z","dependency_job_id":"475f46b1-e4fd-40f8-8d0b-56df511b73e4","html_url":"https://github.com/open-quantum-safe/liboqs-cpp","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/open-quantum-safe/liboqs-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-quantum-safe%2Fliboqs-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-quantum-safe%2Fliboqs-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-quantum-safe%2Fliboqs-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-quantum-safe%2Fliboqs-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-quantum-safe","download_url":"https://codeload.github.com/open-quantum-safe/liboqs-cpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-quantum-safe%2Fliboqs-cpp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263360758,"owners_count":23454780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","cpp","cpp11","cryptography","post-quantum-cryptography","quantum-computing"],"created_at":"2025-06-07T04:08:46.594Z","updated_at":"2025-07-03T16:31:34.029Z","avatar_url":"https://github.com/open-quantum-safe.png","language":"C++","readme":"# liboqs-cpp: C++ bindings for liboqs\n\n[![GitHub actions](https://github.com/open-quantum-safe/liboqs-cpp/actions/workflows/cmake.yml/badge.svg)](https://github.com/open-quantum-safe/liboqs-cpp/actions)\n\n---\n\n## About\n\nThe **Open Quantum Safe (OQS) project** has the goal of developing and\nprototyping quantum-resistant cryptography.\n\n**liboqs-cpp** offers a C++ wrapper for\nthe [Open Quantum Safe](https://openquantumsafe.org/) [liboqs](https://github.com/open-quantum-safe/liboqs/)\nC library, which is a C library for quantum-resistant cryptographic algorithms.\n\nThe wrapper is written in standard C++11, hence in the following it is assumed\nthat you have access to a C++11 compliant compiler. liboqs-cpp has been\nextensively tested on Linux, macOS, FreeBSD and Windows platforms. Continuous\nintegration is provided via GitHub actions.\n\nThe project contains the following files and directories:\n\n- **`include/oqs_cpp.hpp`: main header file for the wrapper**\n- `include/common.hpp`: utility code\n- `include/rand/rand.hpp`: support for RNGs from `\u003coqs/rand.h\u003e`\n- `examples/kem.cpp`: key encapsulation example\n- `examples/rand.cpp`: RNG example\n- `examples/sig.cpp`: signature example\n- `unit_tests`: unit tests written using GoogleTest\n\n---\n\n## Pre-requisites\n\n- [liboqs](https://github.com/open-quantum-safe/liboqs)\n- [git](https://git-scm.com/)\n- [CMake](https://cmake.org/)\n- C++11 compliant compiler, e.g., [gcc](https://gcc.gnu.org/)\n  , [clang](https://clang.llvm.org)\n  , [MSVC](https://visualstudio.microsoft.com/vs/) etc.\n\n---\n\n## Installation\n\n### Configure, build and install liboqs\n\nExecute in a Terminal/Console/Administrator Command Prompt\n\n```shell\ngit clone --depth=1 https://github.com/open-quantum-safe/liboqs\ncmake -S liboqs -B liboqs/build -DBUILD_SHARED_LIBS=ON\ncmake --build liboqs/build --parallel 8\ncmake --build liboqs/build --target install\n```\n\nThe last line may require prefixing it by `sudo` on UNIX-like systems.\nChange `--parallel 8` to match the number of available cores on your system.\n\nOn UNIX-like platforms, you may need to set\nthe `LD_LIBRARY_PATH` (`DYLD_LIBRARY_PATH` on macOS) environment variable to\npoint to the path to liboqs' library directory, e.g.,\n\n```shell\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib\n```\n\nOn Windows platforms, **you must ensure** that the liboqs shared\nlibrary `oqs.dll` is visible system-wide, and that the following environment\nvariable are being set. Use the \"Edit the system environment variables\" Control\nPanel tool or execute in a Command Prompt, e.g.,\n\n```shell\nset PATH=%PATH%;C:\\Program Files (x86)\\liboqs\\bin\n```\n\nYou can change liboqs' installation directory by configuring the build to use an\nalternative path, e.g., `C:\\liboqs`, by replacing the first CMake line above by\n\n```shell\ncmake -S liboqs -B liboqs/build -DCMAKE_INSTALL_PREFIX=\"C:\\liboqs\" -DBUILD_SHARED_LIBS=ON\n```\n\n### Configure and install the wrapper\n\nExecute in a Terminal/Console/Administrator Command Prompt\n\n```shell\ngit clone --depth=1 https://github.com/open-quantum-safe/liboqs-cpp\ncmake -S liboqs-cpp -B liboqs-cpp/build\ncmake --build liboqs-cpp/build --target install\n```\n\n### Build the examples\n\nExecute, on UNIX-like platforms\n\n```shell\ncmake --build liboqs-cpp/build --target examples --parallel 8\n```\n\nand, on Windows platforms\n\n```shell\ncmake --build liboqs-cpp/build --target examples -DLIBOQS_INCLUDE_DIR=\"C:\\Program Files (x86)\\liboqs\\include\" -DLIBOQS_LIB_DIR=\"C:\\Program Files (x86)\\liboqs\\lib\" --parallel 8\n```\n\nNote that you may need to change the flags `-DLIBOQS_INCLUDE_DIR`\nand `-DLIBOQS_LIB_DIR` to point to the correct location of `liboqs` in case you\ninstalled it in a non-standard location.\n\nTo build only a specific target, e.g. `examples/kem`, specify the target as the\nargument of the `cmake` command, e.g.,\n\n```shell\ncmake --build liboqs-cpp/build --target kem\n```\n\n### Run the examples\n\nExecute\n\n```shell\nliboqs-cpp/build/kem\nliboqs-cpp/build/sig\nliboqs-cpp/build/rand\n```\n\nNote that on Windows platforms, the location and the names of the built examples\nmay be slightly different, e.g., `liboqs-cpp/build/Debug/kem.exe`.\n\n### Build and run the unit tests\n\nExecute\n\n```shell\ncmake --build liboqs-cpp/build/unit_tests --target unit_tests --parallel 8\n```\n\nfollowed by\n\n```shell\nctest --test-dir liboqs-cpp/build\n```\n\n---\n\n## Installing liboqs-cpp and using it in standalone applications\n\nliboqs-cpp is a header-only wrapper. To use liboqs-cpp, you only need\nto\n\n```cpp\n#include \u003cliboqs-cpp/oqs_cpp.hpp\u003e\n```\n\nin your application, and have liboqs library installed as described above.\nSee [examples/standalone](https://github.com/open-quantum-safe/liboqs-cpp/tree/main/examples/standalone)\nfor a standalone example.\n\nTo avoid namespace pollution, liboqs-cpp includes all of its code inside the\nnamespace `oqs`. All the liboqs C API is located in the namespace `oqs::C`,\nhence to use directly a C API function you must qualify the call\nwith `oqs::C::liboqs_C_function(...)`.\n\nliboqs-cpp defines four main classes: `oqs::KeyEncapsulation`\nand `oqs::Signature`, providing post-quantum key encapsulation and signture\nmechanisms, respectively, and\n`oqs::KEMs` and `oqs::Sigs`, containing only static member functions that\nprovide information related to the available key encapsulation mechanisms or\nsignature mechanism, respectively.\n\n`oqs::KeyEncapsulation` and/or `oqs::Signature` must be instantiated with a\nstring identifying one of mechanisms supported by liboqs; these can be\nenumerated using the `oqs::KEMs::get_enabled_KEM_mechanisms()`\nand `oqs::Sigs::get_enabled_sig_mechanisms()` member functions.\n\nSupport for alternative RNGs is provided by the `include/rand/rand.hpp` header\nfile, which exports its functions in `namespace oqs::rand`. This header file\nmust be explicitly included in order to activate the support for alternative\nRNGs.\n\nThe wrapper also defines a high resolution timing class, `oqs::Timer\u003c\u003e`.\n\nThe examples in\nthe [`examples`](https://github.com/open-quantum-safe/liboqs-cpp/tree/main/examples)\ndirectory are self-explanatory stand-alone applications and provide more details\nabout the wrapper's API and its usage.\n\n---\n\n## Documentation\n\nTo generate the full official API documentation in both PDF and HTML formats run\n[`doxygen`](http://www.doxygen.nl) on\nthe [`Doxyfile`](https://github.com/open-quantum-safe/liboqs-cpp/blob/main/Doxyfile)\nfile. The tool `dot` from the [`Graphviz`](https://www.graphviz.org) package\nmust be installed (`sudo apt-get install graphviz` in Ubuntu/Debian).\nRunning `doxygen` will generate the documentation directory `doc` containing\nboth the HTML and LaTeX documentation.\n\nThe HTML documentation file will be accessible by opening `doc/html/index.html`\nwith the browser of your choice.\n\nTo generate a PDF file of the documentation, run\n\n```shell\nlatexmk -pdf refman.tex\n```\n\nfrom the `doc/latex` directory or compile the file `doc/latex/refman.tex` with\nyour LaTeX compiler. This will create the `doc/latex/refman.pdf` documentation\nfile. Consult your favourite LaTeX manual for how to compile/build LaTeX files\nunder your specific operating system.\n\n---\n\n## Docker\n\nA self-explanatory minimalistic Docker file is provided\nin [`Dockerfile`](https://github.com/open-quantum-safe/liboqs-cpp/tree/main/Dockerfile).\n\nBuild the image by executing\n\n```shell\ndocker build -t oqs-cpp .\n```\n\nRun, e.g., the key encapsulation example by executing\n\n```shell\ndocker run -it oqs-cpp sh -c \"liboqs-cpp/build/kem\"\n```\n\nOr, run the unit tests with\n\n```shell\ndocker run -it oqs-cpp sh -c \"ctest --test-dir liboqs-cpp/build\"\n```\n\nIn case you want to use the Docker container as a development environment, mount\nyour current project in the Docker\ncontainer with\n\n```shell\ndocker run --rm -it --workdir=/app -v ${PWD}:/app oqs-cpp /bin/bash\n```\n\n---\n\n## Limitations and security\n\nliboqs is designed for prototyping and evaluating quantum-resistant\ncryptography. Security of proposed quantum-resistant algorithms may rapidly\nchange as research advances, and may ultimately be completely insecure against\neither classical or quantum computers.\n\nWe believe that the NIST Post-Quantum Cryptography standardization project is\ncurrently the best avenue to identifying potentially quantum-resistant\nalgorithms. liboqs does not intend to \"pick winners\", and we strongly recommend\nthat applications and protocols rely on the outcomes of the NIST standardization\nproject when deploying post-quantum cryptography.\n\nWe acknowledge that some parties may want to begin deploying post-quantum\ncryptography prior to the conclusion of the NIST standardization project. We\nstrongly recommend that any attempts to do make use of so-called **hybrid\ncryptography**, in which post-quantum public-key algorithms are used alongside\ntraditional public key algorithms (like RSA or elliptic curves) so that the\nsolution is at least no less secure than existing traditional cryptography.\n\nJust like liboqs, liboqs-cpp is provided \"as is\", without warranty of any kind.\nSee [LICENSE](https://github.com/open-quantum-safe/liboqs-cpp/blob/main/LICENSE)\nfor the full disclaimer.\n\n---\n\n## License\n\nliboqs-cpp is licensed under the MIT License;\nsee [LICENSE](https://github.com/open-quantum-safe/liboqs-cpp/blob/main/LICENSE)\nfor details.\n\n---\n\n## Team\n\nThe Open Quantum Safe project is led\nby [Douglas Stebila](https://www.douglas.stebila.ca/research/)\nand [Michele Mosca](https://faculty.iqc.uwaterloo.ca/mmosca/) at the University\nof Waterloo.\n\nliboqs-cpp was developed by [Vlad Gheorghiu](https://vsoftco.github.io) at\n[softwareQ Inc.](https://www.softwareq.ca) and at the University of Waterloo.\n\n---\n\n## Support\n\nFinancial support for the development of Open Quantum Safe has been provided by\nAmazon Web Services and the Canadian Centre for Cyber Security.\n\nWe'd like to make a special acknowledgement to the companies who have dedicated\nprogrammer time to contribute source code to OQS, including Amazon Web Services,\nevolutionQ, softwareQ, and Microsoft Research.\n\nResearch projects which developed specific components of OQS have been supported\nby various research grants, including funding from the Natural Sciences and\nEngineering Research Council of Canada (NSERC); see the source papers for\nfunding acknowledgments.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-quantum-safe%2Fliboqs-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-quantum-safe%2Fliboqs-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-quantum-safe%2Fliboqs-cpp/lists"}