Skip to main content

Super-Simple AGE - A wrapper around python age (actually good encryption)

Project description

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

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

ssage-1.5.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssage-1.5.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file ssage-1.5.1.tar.gz.

File metadata

  • Download URL: ssage-1.5.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ssage-1.5.1.tar.gz
Algorithm Hash digest
SHA256 8364a904a26601b850639025ec3d4d768fc42d9772ae80c5867248a580759c81
MD5 9586b9f04f79c021b087111b8c67b181
BLAKE2b-256 3d43e0ff6eb6b76a80b5fc2a4c44e55bb9684e02c02026345361b1cf7206b94e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ssage-1.5.1.tar.gz:

Publisher: pypi-deploy.yml on esoadamo/ssage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ssage-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: ssage-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ssage-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42580b0e1a60a7e0bc3bb8230bd854e57811552fd68e1bdd309acc1709b0c4de
MD5 86fd70fa976e91dabcc5234635644c20
BLAKE2b-256 7fff1a41ecad13375196361ae7aa4eff41792830eb5cb26e066d3aca77f78846

See more details on using hashes here.

Provenance

The following attestation bundles were made for ssage-1.5.1-py3-none-any.whl:

Publisher: pypi-deploy.yml on esoadamo/ssage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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