Skip to main content

krypto-py

The Python module of krypto: secrets in locked memory, authenticated encryption at rest, key derivation, signatures, key agreement and password hashing. It is the same API as the Rust crate krypto, with the same names, and the same Rust code runs inside it — so what one seals, the other opens.

pip install krypto-py

It needs Python 3.11 or newer, and is tested with 3.11 and 3.12. Wheels are built for Linux on x86_64 with glibc 2.34 or newer; elsewhere pip builds from source, which needs Rust.

import krypto_py as krypto

krypto.harden_process()
master = krypto.MasterKey.from_secret_file("/run/secrets/master_key")
key = master.derive(b"my-app/tokens/v1", b"per-store-salt")

secret = krypto.SecretBuf.from_vec(bytearray(b"api-token"))   # the bytearray is zeroed
blob = krypto.seal(key, master.key_id(), secret, krypto.Alg.Aegis256)
back = krypto.open(key, blob)                                 # a SecretBuf: the plaintext stays locked

Errors are exceptions, one per kind, all under krypto_py.Error. AuthError means tampering or the wrong key, and is the one to alert on.

The secrets live in krypto's locked memory, kept out of core dumps and wiped when dropped. What Python itself holds — the bytes you pass in, and the copies expose hands out — is ordinary Python memory, neither locked nor wiped.

License: MIT or Apache-2.0, at your option.

Metadata

Release files for krypto-py 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for krypto-py 0.8.0
File Size Uploaded Provenance Actions
krypto_py-0.8.0.tar.gz 180.5 kB Without provenance Details for krypto_py-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for krypto-py 0.8.0
File Interpreter ABI Platform Actions
krypto_py-0.8.0-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details for krypto_py-0.8.0-cp311-abi3-manylinux_2_34_x86_64.whl

Total release size: 1.1 MB

Release files / krypto_py-0.8.0.tar.gz

Download URL krypto_py-0.8.0.tar.gz
Size 180.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d92dcc5c0cfb9916f80a29a051c094c855123043031beecb8cc448a7be7bb566
BLAKE2b-256 checksum
How to use checksums
02044ab3ef27c2c0035da36c1bb2dfc01c50ceaa6818ec3acabb0437d10d295f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / krypto_py-0.8.0-cp311-abi3-manylinux_2_34_x86_64.whl

Download URL krypto_py-0.8.0-cp311-abi3-manylinux_2_34_x86_64.whl
Size 924.5 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
af99d47d8632a28dbdbab752689b3fb3215d07dd34ae93aa89ed8cd1a0479099
BLAKE2b-256 checksum
How to use checksums
6570b21695384b7b6ad0b0c8f4d2dd39d4281a60055b506bbf057a391fdbdffb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for krypto-py 0.8.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page