This release is a pre-release and may not be stable for production use.
Swarmauri Crypto PGP
PGPCrypto is an OpenPGP (GnuPG-backed) crypto provider that implements the
ICrypto contract from swarmauri_core. It combines modern AEAD primitives
with OpenPGP public-key operations so that the same component can handle
symmetrical encryption, public-key key wrapping, and hybrid envelopes.
Features at a glance
- Symmetric AEAD ? AES-256-GCM powers
encryptanddecrypt. - Key wrapping ?
wrapandunwrapdelegate to GnuPG to protect random or supplied key material with a recipient's public/private key pair. - Hybrid envelopes ?
encrypt_for_manysupports both traditional KEM+AEAD (shared ciphertext + wrapped session key) and OpenPGP sealed mode for per-recipient ciphertexts. - Sealing convenience ?
sealandunsealprovide single-recipient OpenPGP public-key encryption without managing the envelope structure.
System requirements
- Python 3.10 ? 3.13.
- GnuPG available on the
PATH(required bypython-gnupg).
Key material expectations
encrypt/decrypt:KeyRef.materialmust be 16/24/32 bytes for AES-GCM.wrap/encrypt_for_many:KeyRef.publicmust be ASCII-armored OpenPGP public key bytes.unwrap/unseal:KeyRef.materialmust be ASCII-armored OpenPGP private key bytes. Supply a passphrase viaKeyRef.tags["passphrase"]when needed.
Installation
Choose the tool that matches your workflow:
# pip
pip install swarmauri_crypto_pgp
# Poetry
poetry add swarmauri_crypto_pgp
# uv
uv add swarmauri_crypto_pgp
Quickstart
The snippet below mirrors the asynchronous usage exercised in the tests. It
creates a symmetric KeyRef, encrypts plaintext, and decrypts the resulting
AEADCiphertext back to bytes.
import asyncio
from swarmauri_crypto_pgp import PGPCrypto
from swarmauri_core.crypto.types import ExportPolicy, KeyRef, KeyType, KeyUse
async def main() -> None:
crypto = PGPCrypto()
# Symmetric key for AES-256-GCM
sym = KeyRef(
kid="sym1",
version=1,
type=KeyType.SYMMETRIC,
uses=(KeyUse.ENCRYPT, KeyUse.DECRYPT),
export_policy=ExportPolicy.SECRET_WHEN_ALLOWED,
material=b"\x00" * 32,
)
ct = await crypto.encrypt(sym, b"hello OpenPGP")
pt = await crypto.decrypt(sym, ct)
print(pt)
if __name__ == "__main__":
asyncio.run(main())
Working with recipients
- Call
encrypt_for_manywith recipient public keys to either produce an AES-GCM ciphertext with OpenPGP-wrapped session keys (default) or per-recipient sealed blobs by passingenc_alg="OpenPGP-SEAL". - Use
seal/unsealfor single-recipient OpenPGP public-key encryption. wrapandunwrapoffer direct access to OpenPGP-based key encapsulation.
Entry point
The provider is registered under the swarmauri.cryptos entry-point as
PGPCrypto.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_crypto_pgp 0.11.0.dev2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_crypto_pgp-0.11.0.dev2.tar.gz | 9.8 kB | Without provenance | Details for swarmauri_crypto_pgp-0.11.0.dev2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_crypto_pgp-0.11.0.dev2-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_crypto_pgp-0.11.0.dev2-py3-none-any.whl |
Total release size: 20.7 kB
Release files / swarmauri_crypto_pgp-0.11.0.dev2.tar.gz
| Download URL | swarmauri_crypto_pgp-0.11.0.dev2.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d9052ca3eb8ee8f80911e38e6fd90650bbc1d2d35f29090214affbf36cd4994
|
|
BLAKE2b-256 checksum How to use checksums |
04175c1217bb07248b58274bcfb20ae0454ef02ff4a222577b647e0939f5dfc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_crypto_pgp-0.11.0.dev2-py3-none-any.whl
| Download URL | swarmauri_crypto_pgp-0.11.0.dev2-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57070e3ab4aa2865e43a76e2c19885a8e23cef7b5ea4e7ef2d1f6ad6f451afbe
|
|
BLAKE2b-256 checksum How to use checksums |
255dc5884ef3a1dcb6e768b9ba6686546f341213a0e5a5e21994736a1045b9b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri_crypto_pgp 0.11.0.dev2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.