Skip to main content

OpenPGP (GnuPG) + AES-GCM crypto provider for Swarmauri

Project description

Swamauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_crypto_pgp


Swarmauri Crypto PGP

OpenPGP (GnuPG-backed) crypto provider implementing the ICrypto contract.

  • Symmetric AEAD: AES-256-GCM
  • Key wrapping: OpenPGP public-key encryption (RSA keys recommended)
  • Hybrid encrypt-for-many supported

Key material expectations

  • encrypt/decrypt: KeyRef.material must be 16/24/32 bytes for AES-GCM
  • wrap/encrypt_for_many: KeyRef.public must be ASCII-armored OpenPGP public key bytes
  • unwrap: KeyRef.material must be ASCII-armored OpenPGP private key bytes

Installation

pip install swarmauri_crypto_pgp

Usage

from swarmauri_crypto_pgp import PGPCrypto
from swarmauri_core.crypto.types import KeyRef, KeyType, KeyUse, ExportPolicy

crypto = PGPCrypto()

# Symmetric key for AEAD
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")
pt = await crypto.decrypt(sym, ct)

Entry point

The provider is registered under the swarmauri.cryptos entry-point as PGPCrypto.

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_crypto_pgp-0.2.0.dev3.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_crypto_pgp-0.2.0.dev3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_crypto_pgp-0.2.0.dev3.tar.gz.

File metadata

File hashes

Hashes for swarmauri_crypto_pgp-0.2.0.dev3.tar.gz
Algorithm Hash digest
SHA256 53d328c94e5fd0470e56b214fc3869ddae5fc87babbb21012a0f537c4f188db9
MD5 9cb2be1c26eeb3f60b98098a2f4802a8
BLAKE2b-256 450f13fd118c6e0a9e16bf54f00333c5d2f2bae4a9bca57b7e56127b79f98493

See more details on using hashes here.

File details

Details for the file swarmauri_crypto_pgp-0.2.0.dev3-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_crypto_pgp-0.2.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 ca07212b3c9c018f64e026c7d42e2d6fd3ed9ef5989493ed8eae235e34cf4fad
MD5 635ebf11f90bd863df1ac78239b2494a
BLAKE2b-256 a94b6d05e07a3078be22999405c9fb3279c860805b6524f5d27fa47335806174

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