Skip to main content

Python bindings for rage (age in Rust)

Project description


CI PyPI version

Python bindings for the Rust implementation of age.



You can install pyrage with pip:

$ python -m pip install pyrage

PEP 561-style type stubs are also available:

$ python -m pip install pyrage-stubs

See the development instructions below for manual installations.


Identity generation (x25519 only)

from pyrage import x25519

ident = x25519.Identity.generate()

# returns the public key

# returns the private key

Identity-based encryption and decryption

from pyrage import encrypt, decrypt, ssh, x25519

# load some identities
alice = x25519.Identity.from_str("AGE-SECRET-KEY-...")
bob = ssh.Identity.from_buffer(b"---BEGIN OPENSSH PRIVATE KEY----...")

# load some recipients
carol = x25519.Recipient.from_str("age1z...")
dave = ssh.Recipient.from_str("ssh-ed25519 ...")

# encryption
encrypted = encrypt(b"bob can't be trusted", [carol, dave, alice.to_public()])

# decryption
decrypted = decrypt(encrypted, [alice, bob])

Passphrase encryption and decryption

from pyrage import passphrase

encrypted = passphrase.encrypt(b"something secret", "my extremely secure password")
decrypted = passphrase.decrypt(encrypted, "my extremely secure password")


$ source env/bin/activate
$ make develop


pyrage is released and distributed under the terms of the MIT 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

pyrage-1.1.2.tar.gz (25.7 kB view hashes)

Uploaded Source

Built Distributions

pyrage-1.1.2-cp38-abi3-win_amd64.whl (567.3 kB view hashes)

Uploaded CPython 3.8+ Windows x86-64

pyrage-1.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (689.1 kB view hashes)

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

pyrage-1.1.2-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.2 MB view hashes)

Uploaded CPython 3.8+ macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page