GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Muzosh/liboqs-python: Python wrapper for libOQS

BranchesTags
Open more actions menu

Latest commit

 

History

18 Commits
18 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.sh
build.sh
 
 
oqspython.i
oqspython.i
 
 
pyproject.toml
pyproject.toml
 
 
version.py
version.py
 
 

Repository files navigation

liboqs-python

This repository documents the process of building the Python extension of liboqs library.

Prerequisites

Pip, Python Hatch, cmake, ninja, and a C compiler (e.g. gcc) are required to build the extension.

Installation

  1. Clone this repository
  2. If you already have libOQS repository on the system, specify its location by export LIBOQS_ROOT=/path/to/liboqs
  3. Run build.sh to build dependencies and python package
  4. Run pip install --upgrade --force-reinstall dist/oqspython-*.whl to install the package into your pip environment
  5. from oqs import oqspython in your Python code (based on where it is located relative to the Python file)

Exposed classes and functions

Should be visible in IDE when oqspython is imported. Otherwise, see oqspython.i or oqspython.py.

Example

from oqs import oqspython

sig = oqspython.OQS_SIGNATURE(oqspython.OQS_SIG_alg_dilithium_5)

public_key = bytes(sig.length_public_key)
private_key = bytes(sig.length_private_key)

message = b"This is the message to sign"

result = sig.keypair(public_key, private_key)
assert result == oqspython.OQS_SUCCESS

signature = bytes(sig.length_signature)
result = sig.sign(signature, message, len(message), private_key)
assert result == oqspython.OQS_SUCCESS

result = sig.verify(message, len(message), signature, public_key)
assert result == oqspython.OQS_SUCCESS

kem = oqspython.OQS_KEYENCAPSULATION(oqspython.OQS_KEM_alg_kyber_1024)

public_key = bytes(kem.length_public_key)
private_key = bytes(kem.length_private_key)

result = kem.keypair(public_key, private_key)
assert result == oqspython.OQS_SUCCESS

shared_secret = bytes(kem.length_shared_secret)
ciphertext = bytes(kem.length_ciphertext)
result = kem.encapsulate(ciphertext, shared_secret, public_key)
assert result == oqspython.OQS_SUCCESS

shared_secret2 = bytes(kem.length_shared_secret)
result = kem.decapsulate(shared_secret2, ciphertext, private_key)
assert result == oqspython.OQS_SUCCESS

assert shared_secret == shared_secret2

print("Finished successfully")

About

Python wrapper for libOQS

Topics

bundle-muzosh-post-quantum-auth-on-the-web

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.