Skip to main content

Python bindings for rage (age in Rust)

Project description

pyrage

CI

Python bindings for the Rust implementation of age.

Index

Installation

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.

Usage

Identity generation (x25519 only)

from pyrage import x25519

ident = x25519.Identity.generate()

# returns the public key
ident.to_public()

# returns the private key
str(ident)

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")

Development

$ source env/bin/activate
$ make develop

Licensing

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyrage-1.0.1rc1-cp310-cp310-manylinux_2_28_x86_64.whl (625.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

File details

Details for the file pyrage-1.0.1rc1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyrage-1.0.1rc1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 091c4cced3810809b14aa3ef6d92d3948afd25dee36c911690cddcc43be5fa52
MD5 00838395836c7bc1e011d5003ec25336
BLAKE2b-256 8e2a9c382e7fdb505f4f22cdfa4efbdc8c93fbbe72807ea270679323abb399e7

See more details on using hashes here.

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