Skip to main content

Super-Simple AGE

A wrapper around the age encryption library that makes it easier to use. AGE stands for Actually Good Encryption, and is a modern encryption library that is easy to use and secure.

Additionally, this library provides an authenticated encryption. However, this feature is fully optional and can be disabled, achieving full compatibility with the age library.

Installation

pip install ssage

Supported backends

When using the ssage library, you can choose between backends which handle the actual encryption and decryption. Backends are chosen by passing backend= param to the SSAGE class. The following backends are supported:

Python age

This is the default backend, and it is a pure Python implementation of the age encryption library. Its main advantage is that it does not require any additional dependencies, but does not guarantee side-channel resistance, nor multi-threading support.

Native

Native backend uses the age and age-keygen binaries to perform encryption and decryption. Its main advantage is that is runs anywhere the age binaries are available, the main disadvantage is that is stores the private key in a temporary file.

Pyrage

Pyrage is using a Rust-based binding for the age encryption. Main advantage is that it is faster than the Python age backend, but the Rust library needs to be compiled for the target platform.

Code Example

Simple Encryption

from ssage import SSAGE
e = SSAGE(SSAGE.generate_private_key())
encrypted = e.encrypt('Hello, world!')
print(encrypted)
decrypted = e.decrypt(encrypted)
print(decrypted)
assert decrypted == 'Hello, world!'
print('Test passed!')

Simple Authenticated Encryption

from ssage import SSAGE
e = SSAGE(SSAGE.generate_private_key(), strip=True, authenticate=True)
encrypted = e.encrypt('Hello, world!')
print(encrypted)
decrypted = e.decrypt(encrypted)
print(decrypted)
assert decrypted == 'Hello, world!'
print('Test passed!')

Public Key Encryption

from ssage import SSAGE
public_key = SSAGE(SSAGE.generate_private_key()).public_key
e = SSAGE(public_key=public_key)
encrypted = e.encrypt('Hello, world!')
print(encrypted)
decrypted = e.decrypt(encrypted) # This will fail because the private key is not available

Multiple Recipients

from ssage import SSAGE
public_key_1 = SSAGE(SSAGE.generate_private_key()).public_key
public_key_2 = SSAGE(SSAGE.generate_private_key()).public_key
e = SSAGE(public_key=public_key_1)
e.encrypt('Hello, world!', additional_recipients=[public_key_2])

Metadata

Release files for ssage 1.5.2

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

Source distribution (sdist)

Source distribution for ssage 1.5.2
File Size Uploaded
ssage-1.5.2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ssage 1.5.2
File Interpreter ABI Platform
ssage-1.5.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / ssage-1.5.2.tar.gz

Download URL ssage-1.5.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
32937228ec28a07b152121ae3d345d4d7f02e8d5fbed92762be4a0cbd65e308a
BLAKE2b-256 checksum
How to use checksums
509c0090a3d9f3b64f0a06519aa655b84b930dfbdb526041c25545609af7efd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.14

Release files / ssage-1.5.2-py3-none-any.whl

Download URL ssage-1.5.2-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9802cdab31ce315cf05ee0a297ca3d9f22059c7e629a9ba646703d48f55d07c
BLAKE2b-256 checksum
How to use checksums
bd2bd36c7ff3405a82a8dc4b95712fad438502a0747b49e956d6229ae14d0fe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

1.5.2 This release

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

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