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 Distribution

obcrypt-0.1.2.tar.gz (39.8 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded CPython 3.8+Windows x86-64

obcrypt-0.1.2-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.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (254.7 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

obcrypt-0.1.2-cp38-abi3-macosx_11_0_arm64.whl (238.5 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

obcrypt-0.1.2-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.2.tar.gz.

File metadata

  • Download URL: obcrypt-0.1.2.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for obcrypt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4b4a24decdd563971c4dcb82930a98155021b8d639f055c1ae2aa13bed5de6cd
MD5 4791612d948c878085ede156e4ef6dd5
BLAKE2b-256 01776cce98b83553e584c89effaf4126dfc246862d64d4d36d78e8ebab8c03c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.2.tar.gz:

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.2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: obcrypt-0.1.2-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.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 72d6abb650bb5a14c336b1739a3bb5a0cf755d1ee86a6dcb59771882383e8438
MD5 e74c3b5d9c4eb461cd0182a118c391b9
BLAKE2b-256 98ca537a8ec4c5280c296559772548a6e20786d9366d9e1d91a988e49e312ccf

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.2-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.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c41ee6d8600dd4ee91a9fbad6d7f3b91134891331e52ea3ec541004d0e9bb7c9
MD5 fe0ff93d6b5e58ad274adf99b30153be
BLAKE2b-256 e0c888bb50d269c2c442796eb003968dd568d6983d151e9a35228b37973cde11

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.2-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.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 25bc64691f8a903b2d2a7e153976ff4ae028729fd779f9b7370527c6f4f3ed4a
MD5 6595991dfe7c713e68c12dc124bd7b3c
BLAKE2b-256 8bd2a17add0769be6b4156ae2ec8af00d2521975669ba3773a1262c8eefc79eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.2-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.2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b17e39f8b1ddd878ff56e7405309a0cc663e38bb59e269486f8cb0002830208
MD5 123e039bf2cff721e7f1193cc1096d5a
BLAKE2b-256 3bc1f78cf0b3cdb44c598efc9c0aa0c47db51ba92b6efb4ce5e2e5fadba252cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.2-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.2-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for obcrypt-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5bd9af1f3d9b1474c2967b4ec6f2af5a37686c0a160770cf8f76f17332692039
MD5 b5bc493fe5e9ef735848d4128fdffb2a
BLAKE2b-256 54f6b3eadf4fde7d4140df8d22dcb0c7d1c9fbc49c0077810610455a0a0fb269

See more details on using hashes here.

Provenance

The following attestation bundles were made for obcrypt-0.1.2-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