Skip to main content

NaCl + PKCS#11 crypto provider for Swarmauri

Project description

Swamauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_crypto_nacl_pkcs11


Swarmauri Crypto NaCl PKCS#11

Hybrid crypto provider using PyNaCl for Ed25519/X25519 operations and python-pkcs11 for AES-KW key wrapping. Implements the ICrypto contract via CryptoBase.

  • AES-GCM symmetric encrypt/decrypt
  • AES-KW wrap/unwrap using PKCS#11
  • X25519 sealed boxes for single and multi-recipient encryption

Installation

pip install swarmauri_crypto_nacl_pkcs11

Usage

from swarmauri_crypto_nacl_pkcs11 import NaClPkcs11Crypto
from swarmauri_core.crypto.types import KeyRef, KeyType, KeyUse, ExportPolicy

crypto = NaClPkcs11Crypto()

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 NaClPkcs11Crypto.

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_nacl_pkcs11-0.3.0.dev4.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swarmauri_crypto_nacl_pkcs11-0.3.0.dev4.tar.gz.

File metadata

File hashes

Hashes for swarmauri_crypto_nacl_pkcs11-0.3.0.dev4.tar.gz
Algorithm Hash digest
SHA256 4d83b0bbe3a6c6ffec8d51c70320852395859857055fd27fd38682e360d4580c
MD5 98fe5b3d5ea78c96fb74b99286e458ff
BLAKE2b-256 38731c17b78f67df70244b9a0751494efe412a103f8abc51234fa26b9ce38645

See more details on using hashes here.

File details

Details for the file swarmauri_crypto_nacl_pkcs11-0.3.0.dev4-py3-none-any.whl.

File metadata

File hashes

Hashes for swarmauri_crypto_nacl_pkcs11-0.3.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 529363e26f1a115763a40dbb1bf29b9f1c6e1a56e65d1fe362d54ae1874a8ab2
MD5 805ddba87d8939bcdb71fc1a4ad69e28
BLAKE2b-256 249baadf4664c9d804e1459857dd9f12e1f380e0f3089aaef4a322958f08ac69

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