pyrage
Python bindings for rage (age in Rust)
What it is and what it does
pyrage wraps the Rust implementation of age, a modern file encryption tool, exposing its cryptographic primitives to Python. It supports three encryption modes: identity-based encryption using x25519 keys (with key generation), SSH key-based encryption (reading OpenSSH private keys), and passphrase-based encryption. The package has no runtime dependencies and is distributed as compiled wheels for major platforms.
The library is designed for developers who need age's encryption capabilities in Python applications without reimplementing the cryptography. It handles the complexity of key management, recipient lists, and encryption/decryption workflows through a straightforward API. The package is actively maintained, has no known vulnerabilities, and supports current Python versions.
Use it for:
- Encrypt sensitive files or data using x25519 identities generated within Python applications.
- Decrypt age-encrypted files using SSH keys already present on the system.
- Implement passphrase-protected encryption for user-supplied secrets in CLI tools or scripts.
- Build multi-recipient encryption workflows where different identities can decrypt the same ciphertext.
- Integrate age encryption into Python backend services without calling external binaries.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyrage provides Python bindings to the Rust implementation of age, enabling encryption and decryption using x25519 identities, SSH keys, or passphrases.
Yes. pyrage is actively maintained, has no known vulnerabilities, and offers a clean Python interface to a well-regarded Rust cryptographic library. Install friction is moderate due to compiled bindings, but wheels cover common platforms. Use it if you need age encryption in Python and prefer native bindings over subprocess calls to external tools.
Install
pyrage on PyPI
pip
pip install pyrageuv
uv add pyragepoetry
poetry add pyrageInstalling pyrage
Before you install
Medium install friction due to compiled Rust bindings; wheels are available for Linux x86_64/aarch64, macOS (Intel and Apple Silicon), and Windows x86_64. Requires Python 3.9+. Maintenance is active with recent commits and no known vulnerabilities.
License in practice
MIT license is permissive; you can use, modify, and distribute pyrage freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pyrage
from pyrage import x25519, encrypt, decrypt
ident = x25519.Identity.generate()
recipient = ident.to_public()
encrypted = encrypt(b"secret", [recipient])
decrypted = decrypt(encrypted, [ident])
Requires Python 3.9 or later; compiled wheels are available for common platforms but may require a Rust toolchain if building from source.
Verify before relying
- Whether type stubs (pyrage-stubs) are necessary for your workflow or optional.
- Performance characteristics compared to pure-Python age implementations, if any exist.
- Whether SSH key support covers all OpenSSH formats or has limitations.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 426 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 176,679/month — #10,237 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyrage-1.3.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl; pyrage-1.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; pyrage-1.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; pyrage-1.3.0-cp39-abi3-win_amd64.whl
Tags
More Cryptography packages
Certifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
rsaPure-Python RSA encryption, decryption,…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
PyNaClPyNaCl provides Python bindings to libsodium…
permissive · top 1,000 on PyPI
eciespyEncrypts and decrypts data using Elliptic Curve…
permissive · top 15,000 on PyPI
scryptPython bindings for the scrypt key derivation…
permissive · top 15,000 on PyPI
pyAesCryptEncrypts and decrypts files and binary streams…
permissive · top 15,000 on PyPI
bittensor-drandProvides timelock encryption for Bittensor…
permissive · top 15,000 on PyPI
pyaesPure-Python implementation of AES encryption…
permissive · top 5,000 on PyPI
kasa-cryptProvides fast encryption and decryption…
permissive · top 15,000 on PyPI
gnupgA Python wrapper around GnuPG that lets you…
copyleft · top 5,000 on PyPI
cryptoProvides command-line tools to encrypt and…
permissive · top 5,000 on PyPI
python-olmPython bindings for the Olm cryptographic…
permissive · top 5,000 on PyPI
pyarmorPyarmor obfuscates Python scripts to protect…
unclear · top 15,000 on PyPI