Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/woodruffw/pyrage
Python bindings for rage (age in Rust)
https://github.com/woodruffw/pyrage
age encryption-decryption python rust ssh x25519
Last synced: 29 days ago
JSON representation
Python bindings for rage (age in Rust)
- Host: GitHub
- URL: https://github.com/woodruffw/pyrage
- Owner: woodruffw
- License: mit
- Created: 2022-06-18T01:31:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-04T13:57:09.000Z (about 1 month ago)
- Last Synced: 2024-11-06T05:00:25.016Z (about 1 month ago)
- Topics: age, encryption-decryption, python, rust, ssh, x25519
- Language: Rust
- Homepage: https://pypi.org/project/pyrage/
- Size: 197 KB
- Stars: 52
- Watchers: 3
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-age - pyrage
README
pyrage
======[![CI](https://github.com/woodruffw/pyrage/actions/workflows/ci.yml/badge.svg)](https://github.com/woodruffw/pyrage/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/pyrage.svg)](https://badge.fury.io/py/pyrage)Python bindings for the [Rust implementation of `age`](https://github.com/str4d/rage).
## Index
* [Installation](#installation)
* [Usage](#usage)
* [Development](#development)
* [Licensing](#licensing)## Installation
You can install `pyrage` with `pip`:
```console
$ python -m pip install pyrage
```[PEP 561](https://peps.python.org/pep-0561/)-style type stubs are also available:
```console
$ python -m pip install pyrage-stubs
```See the [development instructions](#development) below for manual installations.
## Usage
### Identity generation (x25519 only)
```python
from pyrage import x25519ident = x25519.Identity.generate()
# returns the public key
ident.to_public()# returns the private key
str(ident)
```### Identity-based encryption and decryption
```python
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
```python
from pyrage import passphraseencrypted = passphrase.encrypt(b"something secret", "my extremely secure password")
decrypted = passphrase.decrypt(encrypted, "my extremely secure password")
```## Development
```console
$ source env/bin/activate
$ make develop
```## Licensing
`pyrage` is released and distributed under the terms of the [MIT License](./LICENSE).