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.dev3.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.dev3.tar.gz.

File metadata

File hashes

Hashes for swarmauri_crypto_nacl_pkcs11-0.3.0.dev3.tar.gz
Algorithm Hash digest
SHA256 c76563e14faca8159874333c7a3ddba7519f208955b9b95b540eddf91a07469b
MD5 f97e00bd7dea2b81641f02a2c78a6bb0
BLAKE2b-256 e49847c41f9eb81deaa274c9e26e2e9655a7a837b5b7645c5583eeb02f571f8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for swarmauri_crypto_nacl_pkcs11-0.3.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 48ed04b487f26a3f91287484244f85ba5429c377df51eca5c62dd8fb41213648
MD5 e5f1193e1089258823577947aa3989fc
BLAKE2b-256 258c3039bb6ff944c602b408609b9eed603d1399edcd357ba77e2494fa377463

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