obcrypt
Python bindings for obcrypt — the bytes-in /
bytes-out cryptographic core of the oboron protocol.
Authenticated 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()
dsiv = obcrypt.Dsiv(key)
payload = dsiv.encrypt(b"hello")
plaintext = dsiv.decrypt(payload)
assert plaintext == b"hello"
Or, from an env var:
import os, obcrypt
dsiv = obcrypt.Dsiv(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.DSIV, key)
plaintext = obcrypt.decrypt(payload, schemes.DSIV, key)
assert plaintext == b"hello"
The output carries no scheme marker, so the same scheme used to
encrypt must be supplied to decrypt; a wrong scheme raises
DecryptionFailed (the authentication check fails).
Schemes
All four are authenticated.
| Name | Determinism | Algorithm |
|---|---|---|
dsiv |
deterministic | AES-SIV |
psiv |
probabilistic | AES-SIV |
dgcmsiv |
deterministic | AES-GCM-SIV |
pgcmsiv |
probabilistic | AES-GCM-SIV |
dsiv is the most general default. 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 keyInvalidScheme— unknown scheme nameEncryptionFailed— AEAD failure / empty plaintextDecryptionFailed— tag check, short payload, wrong scheme
Development build
pip install maturin
cd obcrypt-py
maturin develop --release
License
Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE) or the MIT license (LICENSE-MIT) at your option. Both texts are bundled in the package.
Metadata
Release files for obcrypt 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| obcrypt-1.0.0.tar.gz | 57.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| obcrypt-1.0.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| obcrypt-1.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| obcrypt-1.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| obcrypt-1.0.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| obcrypt-1.0.0-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 1.3 MB
Release files / obcrypt-1.0.0.tar.gz
| Download URL | obcrypt-1.0.0.tar.gz |
|---|---|
| Size | 57.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9abb089139558011ce9bac8853ff17daaee1114a7774699e212c9e98c6b23174
|
|
BLAKE2b-256 checksum How to use checksums |
e22aca540ca3f18b9999f44bdc71de21925c6d0d8db9cd847c9a01620729b71c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.
Transparency logRelease files / obcrypt-1.0.0-cp38-abi3-win_amd64.whl
| Download URL | obcrypt-1.0.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 183.4 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
425a5ebe0b8ff60ccd7903f438c2e747889967a1280ac02587dc579ddb06b876
|
|
BLAKE2b-256 checksum How to use checksums |
58461272b43d4d26f1c19a13bc686e341e632d5a70965ea2b8ac8349681ed165
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.
Transparency logRelease files / obcrypt-1.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | obcrypt-1.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 273.1 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
93e80e30c63467106dc40f5195012614da2e16af6185a70580203b42ebb6875d
|
|
BLAKE2b-256 checksum How to use checksums |
e79f2e6cddcb0cb8a855a2a2dc81441a34e8935227b6ce643cc2cd809c080a28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.
Transparency logRelease files / obcrypt-1.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | obcrypt-1.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 259.0 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
abbd79351654981bd106ad3f3281206369e2a9304dcb94895a895f7541016819
|
|
BLAKE2b-256 checksum How to use checksums |
cff939f0d4cd13d11387f9805860f542e8badb3f3db70ef11e33497e00043d18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.
Transparency logRelease files / obcrypt-1.0.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | obcrypt-1.0.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 244.1 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6b1afb95a080632a42aecff3de1f5415124951748bfbd023dce6de6b66c04728
|
|
BLAKE2b-256 checksum How to use checksums |
fbffff21d7c670a0fa3501c094c9527334c16ed33d59c3ed1a10db629c29182c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.
Transparency logRelease files / obcrypt-1.0.0-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | obcrypt-1.0.0-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 259.2 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
21816a6269bb75f4237c51bdc6d0c74145dc66188d34dfdfd479c97efc10678a
|
|
BLAKE2b-256 checksum How to use checksums |
83767b136cbaa4bf18d05b1f4b5bcec9830bc3cda2d80464157f931499b694b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 28, 2026.
Transparency log