Skip to main content

Python bindings for obcrypt — bytes-in/bytes-out symmetric encryption (oboron protocol, a-tier + u-tier).

Project description

obcrypt

Python bindings for obcrypt — the bytes-in / bytes-out cryptographic core of the oboron protocol. Authenticated (a-tier) and unauthenticated-but-real (u-tier) symmetric encryption operating on raw bytes; no text encoding, no UTF-8 validation.

Install

pip install obcrypt

Wheels are published for Linux (x86_64, aarch64), macOS (arm64, x86_64), and Windows (x86_64). The extension is built against PyO3's stable ABI (abi3-py38); a single wheel covers CPython 3.8 and later.

Keys

Keys are 128-character hex strings — the canonical oboron key form, the same form that comes out of env vars, config files, and secrets managers. Generate one:

import obcrypt

key = obcrypt.generate_key()
# 'd853c88c2b1f...f10649cb'  (128 lowercase hex chars)

Wherever obcrypt takes a key, it takes that string directly. Raw 64-byte key material is available via the key_bytes property and generate_key_bytes() for interop with byte-native APIs (HSMs, cryptography, pynacl, custom storage), but the hex form is the canonical input everywhere.

Quick start

Codec class style

Binds a key and scheme together — most ergonomic when one codec handles many messages.

import obcrypt

key = obcrypt.generate_key()
aasv = obcrypt.Aasv(key)

payload = aasv.encrypt(b"hello")
plaintext = aasv.decrypt(payload)
assert plaintext == b"hello"

Or, from an env var:

import os, obcrypt
aasv = obcrypt.Aasv(os.environ["OBCRYPT_KEY"])

Free-function style

Pass the scheme as a string (or a constant from obcrypt.schemes) on each call.

import obcrypt
from obcrypt import schemes

key = obcrypt.generate_key()

payload = obcrypt.encrypt(b"hello", schemes.AASV, key)
plaintext = obcrypt.decrypt(payload, key)         # auto-detect
assert plaintext == b"hello"

decrypt auto-detects the scheme from the trailing marker in the payload. Use decrypt_as(payload, scheme, key) if you want to require a specific scheme and reject mismatches.

Schemes

Name Tier Determinism Algorithm
aags a (auth) deterministic AES-GCM-SIV
apgs a (auth) probabilistic AES-GCM-SIV
aasv a (auth) deterministic AES-SIV
apsv a (auth) probabilistic AES-SIV
upbc u (unauth) probabilistic AES-CBC

See the obcrypt crate docs for algorithm details and per-scheme use-case guidance.

Exceptions

All errors inherit from obcrypt.ObcryptError:

  • InvalidKey — bad hex / wrong-length key
  • InvalidScheme — unknown scheme name / marker mismatch
  • EncryptionFailed — AEAD failure / empty plaintext
  • DecryptionFailed — tag check, padding, short payload, etc.

Development build

pip install maturin
cd obcrypt-py
maturin develop --release

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

obcrypt-0.1.0-cp38-abi3-win_amd64.whl (181.8 kB view details)

Uploaded CPython 3.8+Windows x86-64

obcrypt-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (269.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

obcrypt-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (254.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

obcrypt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl (238.6 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

obcrypt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl (256.1 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file obcrypt-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: obcrypt-0.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 181.8 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for obcrypt-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d50225d26be5f962ab64e0ad610d17bfc3ac6ff8409cdd271e0fcb7b3032cdfe
MD5 6824286e9eac64606391b14822bc7d71
BLAKE2b-256 ca5d4aee808d0b28be071c856cb52dc018331aee21bb4b323f081fb5e5d51ebd

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.0-cp38-abi3-win_amd64.whl:

Publisher: publish-pypi.yml on deyanovich/obcrypt-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file obcrypt-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb2a9814e773e5869745fd68f4bc0b963386bc6d96ebacc673fe004bb764ddef
MD5 f6c3bc18a982ca116efdecbc22318c53
BLAKE2b-256 8662016e9af62151a889fb9e08175a2ed5352a7e06e5549cbbaeb493742e570e

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on deyanovich/obcrypt-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file obcrypt-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1098ff1c8f901180dd7806ac975989edab0389e6b199056829928ca3d34eb5ae
MD5 f8ab933a3349bb74c5292b7cd2c6696f
BLAKE2b-256 1ce9d81d96f4d64dad96bfe68f6b933658b13cd14a70e77c3dc105990c95d7d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-pypi.yml on deyanovich/obcrypt-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file obcrypt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd60c05cd5d2d3b1f3e8eafa403b347fa6c7c8722846fab096d9101e8dc1813c
MD5 5b486ddf253fcb36f28a039e205d0dcc
BLAKE2b-256 c6f26fa32d8e02fbbb90a9879591e9f0ac87281a8bb990472d4d1bea792a49f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on deyanovich/obcrypt-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file obcrypt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e382e937b5c7a677bd110eec1f58ff5d4a71efb25de06fc2f3cde44a31268a40
MD5 a04c9cdc9e352dfa7816eccc4885feb6
BLAKE2b-256 c82cad8dd9f404bf290ce5917d394317a32b505979947a812a157d4273ce173d

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-pypi.yml on deyanovich/obcrypt-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page