This release is a pre-release and may not be stable for production use.
Swarmauri Signing PGP
The swarmauri_signing_pgp package provides an OpenPGP signer for the Swarmauri
SDK. It creates and verifies detached signatures over raw byte payloads or
structured envelopes that are canonicalized to JSON or, optionally, CBOR.
Features
- Detached OpenPGP signatures for bytes and envelopes
- JSON canonicalization with optional CBOR support via
cbor2 - Multi-signer verification with configurable minimum signer requirements
- Private key loading from in-memory
pgpyobjects or ASCII-armored blobs - Passphrase handling for locked private keys
Installation
Install the package with your preferred Python packaging tool:
pip install swarmauri_signing_pgp
poetry add swarmauri_signing_pgp
uv pip install swarmauri_signing_pgp
Optional CBOR support
Enable canonicalization to CBOR by installing the optional dependency group:
pip install "swarmauri_signing_pgp[cbor]"
poetry add swarmauri_signing_pgp -E cbor
uv pip install "swarmauri_signing_pgp[cbor]"
Usage
The signer exposes asynchronous methods from the Swarmauri signing base class.
Key references are dictionaries describing how to load private keys. For pgpy
objects, the signer expects a mapping such as {"kind": "pgpy_key", "priv": pgpy_key}. Verification requires the corresponding public keys supplied in the
opts={"pubkeys": [...]} argument.
Sign and verify raw bytes
import asyncio
from pgpy import PGPKey, PGPUID
from pgpy.constants import (
CompressionAlgorithm,
HashAlgorithm,
KeyFlags,
PubKeyAlgorithm,
SymmetricKeyAlgorithm,
)
from swarmauri_signing_pgp import PgpEnvelopeSigner
def make_demo_key() -> PGPKey:
key = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 2048)
uid = PGPUID.new("Example User", email="user@example.com")
key.add_uid(
uid,
usage={KeyFlags.Sign},
hashes=[HashAlgorithm.SHA256],
ciphers=[SymmetricKeyAlgorithm.AES256],
compression=[CompressionAlgorithm.ZLIB],
)
return key
async def main() -> None:
signer = PgpEnvelopeSigner()
key = make_demo_key()
key_ref = {"kind": "pgpy_key", "priv": key}
payload = b"openpgp demo"
signatures = await signer.sign_bytes(key_ref, payload)
verified = await signer.verify_bytes(
payload,
signatures,
opts={"pubkeys": [key.pubkey]},
)
print("Verified:", verified)
asyncio.run(main())
The signer returns detached signatures that include both binary and ASCII-armored
representations. Passphrases for locked private keys can be supplied through
opts={"passphrase": "secret"}.
Sign envelopes
Envelopes are canonicalized before signing. JSON canonicalization is always available and CBOR becomes available when the optional dependency group is installed:
envelope = {"subject": "demo", "body": "hello"}
signatures = await signer.sign_envelope(key_ref, envelope, canon="json")
await signer.verify_envelope(
envelope,
signatures,
canon="json",
opts={"pubkeys": [key.pubkey]},
)
Use canon="cbor" to opt into CBOR canonicalization. The supports() helper
exposes the available algorithms, canonicalization formats, and feature flags at
runtime.
Metadata
Release files for swarmauri_signing_pgp 0.11.0.dev1
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_signing_pgp-0.11.0.dev1.tar.gz | 10.3 kB | Without provenance | Details for swarmauri_signing_pgp-0.11.0.dev1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_signing_pgp-0.11.0.dev1-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_signing_pgp-0.11.0.dev1-py3-none-any.whl |
Total release size: 21.5 kB
Release files / swarmauri_signing_pgp-0.11.0.dev1.tar.gz
| Download URL | swarmauri_signing_pgp-0.11.0.dev1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76f8a9dae9f7c8d53ae1605fa3bc04e40f0281ed94b20f78ee47b2fddb098128
|
|
BLAKE2b-256 checksum How to use checksums |
9cedb677ee86df09fe2bf77c611240e8592d3a54e3ddebb967defe356c6f1ce9
|
| 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_signing_pgp-0.11.0.dev1-py3-none-any.whl
| Download URL | swarmauri_signing_pgp-0.11.0.dev1-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eccc1b0ff12891481b3b941338ed195331de289ae3c241d479028026f463d7d4
|
|
BLAKE2b-256 checksum How to use checksums |
5777c988e5e71363bfec3363c77fca3684c57ca035f260bab13f4da27ceda869
|
| 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_signing_pgp 0.11.0.dev1
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.