Skip to main content

Age-style X25519 sealed-per-recipient MRE provider for Swarmauri

Project description

Swamauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_mre_crypto_age


Swarmauri MRE Crypto Age

Age-based multi-recipient encryption provider implementing the IMreCrypto contract.

  • Sealed-per-recipient X25519 stanzas
  • ChaCha20-Poly1305 payload encryption
  • Deterministic recipient identifiers via SHA-256 public key fingerprints

Installation

pip install swarmauri_mre_crypto_age

Usage

The provider exposes asynchronous helpers for encrypting data to many recipients and decrypting it for a specific private key. The example below walks through a complete round trip.

  1. Create the crypto provider.
  2. Generate key pairs for two recipients.
  3. Encrypt a payload for both recipients.
  4. Decrypt the payload for one recipient.
from swarmauri_mre_crypto_age import AgeMreCrypto
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey

crypto = AgeMreCrypto()

# generate key pairs for each participant
sk1 = X25519PrivateKey.generate()
pk1 = sk1.public_key()
sk2 = X25519PrivateKey.generate()
pk2 = sk2.public_key()

recipients = [
    {"kind": "cryptography_obj", "obj": pk1},
    {"kind": "cryptography_obj", "obj": pk2},
]

env = await crypto.encrypt_for_many(recipients, b"secret")
pt = await crypto.open_for({"kind": "cryptography_obj", "obj": sk1}, env)
assert pt == b"secret"

Entry point

The provider is registered under the swarmauri.mre_cryptos entry-point as AgeMreCrypto.

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

swarmauri_mre_crypto_age-0.3.0.dev4.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_mre_crypto_age-0.3.0.dev4-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_mre_crypto_age-0.3.0.dev4.tar.gz.

File metadata

File hashes

Hashes for swarmauri_mre_crypto_age-0.3.0.dev4.tar.gz
Algorithm Hash digest
SHA256 add86405383095d0f65822b42deb8bad6f1b3c56645c46899c91115f7825d19a
MD5 8687765918fd6558f2b97205c75146ed
BLAKE2b-256 7ad8c594bf584a55e662318b517f228acb36223e42e117de9293f11ff7ae4753

See more details on using hashes here.

File details

Details for the file swarmauri_mre_crypto_age-0.3.0.dev4-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_mre_crypto_age-0.3.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 48bcbc809fec694230ca82cdd5c1c50ea91319a051ad42dbfd9ecfa1d054384a
MD5 615e9217fa268b6ea04663e2c7e156db
BLAKE2b-256 670b8eae7eb253d9b3d15f403ed9196c8007c83693e36e5b147b205ccd878504

See more details on using hashes here.

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