OpenPGP sealed-per-recipient MRE provider for Swarmauri
Project description
Swarmauri MRE Crypto PGP
OpenPGP-based multi-recipient encryption providers implementing the
IMreCrypto contract. This package exposes three providers:
- PGPSealMreCrypto – per-recipient sealed payloads
(
sealed_per_recipientmode). - PGPSealedCekMreCrypto – shared AEAD payload with per-recipient sealed
CEK (
sealed_cek+aeadmode). - PGPMreCrypto – composite provider supporting both the
enc_once+per_recipient_headerandsealed_per_recipientmodes.
All providers use OpenPGP public key encryption via PGPy.
Installation
pip install swarmauri_mre_crypto_pgp
Usage
import asyncio
from pgpy import PGPKey, PGPUID
from pgpy.constants import (
CompressionAlgorithm,
HashAlgorithm,
KeyFlags,
PubKeyAlgorithm,
SymmetricKeyAlgorithm,
)
from swarmauri_mre_crypto_pgp import PGPMreCrypto
async def main():
# Generate an OpenPGP key pair with pgpy
key = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048)
uid = PGPUID.new("Test User", email="test@example.com")
key.add_uid(
uid,
usage={KeyFlags.EncryptCommunications},
hashes=[HashAlgorithm.SHA256],
ciphers=[SymmetricKeyAlgorithm.AES256],
compression=[CompressionAlgorithm.ZLIB],
)
# Create references understood by the provider
pub_ref = {"kind": "pgpy_pub", "pub": key.pubkey}
priv_ref = {"kind": "pgpy_priv", "priv": key}
# Encrypt for many and open with the private key
mre = PGPMreCrypto()
pt = b"hello"
env = await mre.encrypt_for_many([pub_ref], pt)
rt = await mre.open_for(priv_ref, env)
print(rt)
if __name__ == "__main__":
asyncio.run(main())
Entry point
Providers are registered under the swarmauri.mre_cryptos entry-point as
PGPSealMreCrypto, PGPSealedCekMreCrypto and PGPMreCrypto.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_mre_crypto_pgp-0.3.0.dev4.tar.gz.
File metadata
- Download URL: swarmauri_mre_crypto_pgp-0.3.0.dev4.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acf88b62915263ab9f4d8e03e5b73a01779902f221d2a7b32f7034d2751e5c66
|
|
| MD5 |
364ce951b89d87a3a57f9fefc12c2380
|
|
| BLAKE2b-256 |
a8c723f4d12bd1b838e4a29a415ad37a53894d1da60e99d116c916e6831c7148
|
File details
Details for the file swarmauri_mre_crypto_pgp-0.3.0.dev4-py3-none-any.whl.
File metadata
- Download URL: swarmauri_mre_crypto_pgp-0.3.0.dev4-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7146e9332702be49e5d2ff16950c35e609f8920e54bc457a51ff9608618ddc90
|
|
| MD5 |
c8ba368c55adce7654a535dd43f033c1
|
|
| BLAKE2b-256 |
2e54dea5939fe2336050a0e67f45c241daadf8209192ab0999c5c8b4a5a9226b
|