pyoqs-sdk

Python wrapper for liboqs PyPi package


License
Other
Install
pip install pyoqs-sdk==1.0

Documentation

Quantum-Proof Security with pyoqs_sdk in Python

Build status

Build status Python Dependencies Contributions welcome License

pyoqs_sdk PyPi : https://pypi.org/project/pyoqs-sdk/

The Open Quantum Safe (OQS) project has the goal of developing and prototyping quantum-resistant cryptography. liboqs is an open source C library for quantum-resistant cryptographic algorithms. See more about liboqs at https://github.com/open-quantum-safe/liboqs/, including a list of supported algorithms.

pyoqs_sdk is an open-source Python 3 library that wraps the liboqs C library. It offers a unified API for post-quantum key encapsulation and digital signature schemes, as well as a collection of open-source implementations of post-quantum cryptography algorithms.

The OQS project also includes prototype integrations into various application-level protocols to test the effectiveness of quantum-resistant cryptography. For more information, visit https://openquantumsafe.org/

Pre-requisite

Python 3.x pyoqs_sdk depends on the liboqs C library; liboqs must first be compiled as a Linux/macOS/Windows library.

Contents

This Project contains following Contents

  • pyoqs_sdk/pyoqs_sdk.py: a Python 3 module wrapper for the liboqs C library.
  • pyoqs_sdk/rand.py: a Python 3 module supporting RNGs from <oqs/rand.h>
  • test: unit test to be added

Installation

This project is on PyPI and can be installed with

pip install pyoqs_sdk

First, you must build liboqs according to the liboqs building instructions with shared library support enabled (add -DBUILD_SHARED_LIBS=ON to the cmake command), followed (optionally) by a sudo ninja install to ensure that the shared library is visible system-wide (by default it installs under /usr/local/include and /usr/local/lib on Linux/macOS).

On Linux/macOS you may need to set the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on macOS) environment variable to point to the path to liboqs' library directory, e.g.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

Alternatively, you can install it from this repository directly:

git clone https://github.com/sagarbhure/pyoqs_sdk
cd pyoqs_sdk
python3 setup.py install

Running Tests [In-progress]

To run the unit tests without a test runner:

python3 tests/test_kem.py
python3 tests/test_sig.py

Usage

The pyoqs_sdk library offers two main classes, KeyEncapsulation and Signature, for implementing post-quantum key encapsulation and signature mechanisms. To use these classes, you must instantiate them with a string that identifies one of the mechanisms supported by liboqs.

You can use the get_enabled_KEM_mechanisms() and get_enabled_sig_mechanisms() functions to enumerate the available options. The examples in the examples/ directory show how to use the library's API. Additionally, the library supports alternative RNGs through the randombytes[] functions.

Authors