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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for swarmauri_crypto_pgp-0.2.0.dev4.tar.gz
Algorithm Hash digest
SHA256 aa52b2915d42c2bc5ab2f21a761f9b12729ac86478d960a58fa0e081d45fa587
MD5 cd90ca9c6aa2f2f59c2cc359dec2fc32
BLAKE2b-256 e6f07263f00948d7fa226cc7c9d11a60d503cf2791be85a3991b1a4c3765c266

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for swarmauri_crypto_pgp-0.2.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 69c9db8ff03bad09e683902712f82f056fffe197a85d11e408f3e4aa7038bd4a
MD5 3ff63994d6c37cc514310a50fbfa0669
BLAKE2b-256 cbe7b9c16c34c792123f6fa26367d1605d867f44f70f7620e775de1d28c7b4a7

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