Skip to main content

Python bindings for oboron — string-in/string-out symmetric encryption + encoding (Aags, Aasv, Apgs, Apsv, Upbc, Zrbcx).

Project description

oboron

PyPI Python Versions License: MIT oboron crate

Python bindings for oboron — a string-in, string-out symmetric encryption and encoding library. One call takes plaintext to obtext (encrypted + encoded), one call brings it back. Multiple AES-based schemes (deterministic and probabilistic, authenticated and unauthenticated) share a single key and a uniform API.

For the bytes-in/bytes-out cryptographic core (no encoding, no UTF-8 validation), see obcrypt-py. oboron-py layers encoding, format strings, and autodetection on top.

Install

pip install oboron

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 per platform 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 oboron

key = oboron.generate_key()
# 'b5129efd1cf34b0c7a83...'  (128 lowercase hex chars)

Wherever oboron 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 hex is the canonical input everywhere.

The legacy 86-character base64 form is still accepted for backward compatibility, but is deprecated and will be removed when the oboron core ships 1.0. New code should use hex.

Quick start

Fixed-format codec (most common)

import oboron

key = oboron.generate_key()
ob = oboron.AasvC32(key)

obtext = ob.enc("hello, world")
plaintext = ob.dec(obtext)
assert plaintext == "hello, world"

AasvC32 binds a key + the aasv.c32 format together — most ergonomic when one codec handles many messages of the same format. Available classes follow the {Scheme}{Encoding} pattern: AagsB64, AasvHex, ApsvC32, UpbcB32, etc.

Or, from an env var:

import os, oboron
ob = oboron.AasvC32(os.environ["OBORON_KEY"])

Runtime-flexible (Ob)

When the format is chosen at runtime (config, user input), use Ob — same shape, but set_format / set_scheme / set_encoding mutate the format in place.

ob = oboron.Ob("aasv.b64", key)
obtext = ob.enc("hello")

ob.set_encoding("c32")     # now aasv.c32
ob.set_scheme("aags")      # now aags.c32
ob.set_format("upbc.hex")  # now upbc.hex

Multi-format (Omnib)

Omnib doesn't store a format — pass one per call, and autodec detects both scheme and encoding from the obtext.

omb = oboron.Omnib(key)

ot_aasv = omb.enc("hello", "aasv.b64")
ot_aags = omb.enc("hello", "aags.c32")

assert omb.autodec(ot_aasv) == "hello"   # detects aasv + b64
assert omb.autodec(ot_aags) == "hello"   # detects aags + c32

Autodetection retries across encodings; expect ~3x worst-case overhead vs known-format dec, though the heuristic encoding detector keeps the average much closer to single-dec cost.

Free functions

For one-off operations without instantiating a codec:

import oboron
from oboron import formats

key = oboron.generate_key()

obtext = oboron.enc("hello", formats.AASV_B64, key)
plaintext = oboron.dec(obtext, formats.AASV_B64, key)
plaintext_auto = oboron.autodec(obtext, key)

Schemes

Name Tier Determinism Algorithm Use case
aags a deterministic AES-GCM-SIV Auth + compact + deterministic
apgs a probabilistic AES-GCM-SIV Auth + max privacy
aasv a deterministic AES-SIV General-purpose auth, nonce-misuse safe
apsv a probabilistic AES-SIV Auth + max privacy + nonce-misuse safe
upbc u probabilistic AES-CBC Confidentiality only (auth handled extern)
zrbcx z deterministic AES-CBC, fixed Obfuscation only — NOT SECURE

Tier letters: a = authenticated, u = unauthenticated but real cryptography, z = obfuscation only (no cryptographic security). For new security-sensitive work, pick an a-tier scheme; aasv is a strong default.

The z-tier (zrbcx, legacy) lives under oboron.ztier and uses a 32-byte secret instead of a 64-byte master key:

import oboron
from oboron.ztier import ZrbcxC32

secret = oboron.generate_secret()   # 64-char hex
z = ZrbcxC32(secret)
obtext = z.enc("hello")             # 'c38jrtewavbm9609ga970bjxx5k42'

For obfuscation contexts where everyone is allowed to decrypt (IDs, captcha challenges, URL slugs), use keyless=True:

z = ZrbcxC32(keyless=True)

Encodings

Encoding Description Notes
b32 RFC 4648 base32 Uppercase, no obscenity rules
c32 Crockford base32 Lowercase, obscenity-aware
b64 RFC 4648 URL-safe base64 Most compact
hex Hexadecimal Longest output, fastest decode

Format = scheme.encoding, e.g. aasv.c32, aags.b64, upbc.hex. The oboron.formats module exposes every valid combination as a constant: formats.AASV_C32, formats.AAGS_B64, etc. — useful for typo-resistance and editor autocomplete.

Exceptions

All errors inherit from oboron.OboronError:

  • InvalidKey — bad hex / base64 / wrong-length key
  • InvalidFormat — unknown scheme, unknown encoding, malformed format string
  • EncryptionFailed — AEAD failure / empty plaintext
  • DecryptionFailed — tag check, padding, obtext-decode failure, post-decrypt UTF-8 validation
try:
    ob = oboron.AasvC32("not-a-real-key")
except oboron.InvalidKey as e:
    ...

Inheritance / isinstance

All a/u-tier codec classes plus Ob are registered as virtual subclasses of oboron.OboronBase; z-tier codecs (ZrbcxC32, Legacy, etc.) plus Obz register against oboron.ztier.ZtierBase. Useful for generic code:

def encrypt_each(cipher: oboron.OboronBase, items: list[str]) -> list[str]:
    return [cipher.enc(item) for item in items]

Keyless mode

Every codec accepts keyless=True instead of a key — it substitutes a publicly hardcoded key. This is for testing and obfuscation contexts where you actively want the output to be recoverable without secret material. Never use keyless=True when confidentiality matters.

ob = oboron.AagsB64(keyless=True)

Development build

pip install maturin
cd oboron-py
maturin develop --release
python -m oboron.test_inheritance

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

oboron-0.9.0.tar.gz (30.5 kB view details)

Uploaded Source

Built Distributions

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

oboron-0.9.0-cp38-abi3-win_amd64.whl (372.4 kB view details)

Uploaded CPython 3.8+Windows x86-64

oboron-0.9.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (432.0 kB view details)

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

oboron-0.9.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (399.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

oboron-0.9.0-cp38-abi3-macosx_11_0_arm64.whl (380.3 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

oboron-0.9.0-cp38-abi3-macosx_10_12_x86_64.whl (416.1 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file oboron-0.9.0.tar.gz.

File metadata

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

File hashes

Hashes for oboron-0.9.0.tar.gz
Algorithm Hash digest
SHA256 d23eaa30f55aa532883855d0f7bf6b3c70ed946b1d133908cf93e436ebbc4a76
MD5 376783b74a890f46eda9e5c015c3dc7d
BLAKE2b-256 1a1a63708ac4c5def9b07a35e15b6893470f5a5dc7dbb598bb1b0e4f4bd2a95b

See more details on using hashes here.

Provenance

The following attestation bundles were made for oboron-0.9.0.tar.gz:

Publisher: publish-pypi.yml on deyanovich/oboron-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 oboron-0.9.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: oboron-0.9.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 372.4 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 oboron-0.9.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0c602a57520fc8208a3607c105aeb1b39a170a5fd82d0f3ef01745498f42804c
MD5 f87d0a883872f52ae80bfe707124aba4
BLAKE2b-256 f0bbb551bf965b00a38f9db7ab1e56f8bb5c83a4c426de1b2616da1ae809c1bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for oboron-0.9.0-cp38-abi3-win_amd64.whl:

Publisher: publish-pypi.yml on deyanovich/oboron-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 oboron-0.9.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for oboron-0.9.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d24b641e1d7d82574796fe8b780a41f7ce48b774aa693f6da0f308b79b4c279
MD5 b4ed4f2fccd4615cd8e181c14665eb34
BLAKE2b-256 eb1adaec26d12e73b81f1e855c74ead71f2419da8cfa7e7ed25d9ca16bbc15ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for oboron-0.9.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on deyanovich/oboron-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 oboron-0.9.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for oboron-0.9.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 69536a3184d26d1dbe81f39e78b1efa5fc6bf5d3cd59b666c676f15dc6984004
MD5 ac4d60cd5b8a0804effe4940ee92cbdb
BLAKE2b-256 3fabed05e1eb78adbd1eb881eed8ac0d135619ae402dbbba7bfb0def2955c43c

See more details on using hashes here.

Provenance

The following attestation bundles were made for oboron-0.9.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-pypi.yml on deyanovich/oboron-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 oboron-0.9.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: oboron-0.9.0-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 380.3 kB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oboron-0.9.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a434aa604282d9759db2f16db8a29f0f1b7608cc7e3c8a6b5197369f95aa2d59
MD5 bbbd0b207596f101154590f326f18eda
BLAKE2b-256 497f8d9031c9e01429efcd24e33c1d84de70c6befe36a8abf9bcb56bc100c78f

See more details on using hashes here.

Provenance

The following attestation bundles were made for oboron-0.9.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on deyanovich/oboron-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 oboron-0.9.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for oboron-0.9.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2a7ee5aa1a02ab6046a8f4d5047d2f1ac173960274605293d52375f5976382a9
MD5 617fb8db158131480c14cfc39a8a5eb4
BLAKE2b-256 2f6bb203021142925fa02818cc8104e71dcd8767db86f99d1e818e70d5a8262c

See more details on using hashes here.

Provenance

The following attestation bundles were made for oboron-0.9.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-pypi.yml on deyanovich/oboron-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