NaCl + PKCS#11 crypto provider for Swarmauri
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_crypto_nacl_pkcs11-0.3.0.dev3.tar.gz.
File metadata
- Download URL: swarmauri_crypto_nacl_pkcs11-0.3.0.dev3.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c76563e14faca8159874333c7a3ddba7519f208955b9b95b540eddf91a07469b
|
|
| MD5 |
f97e00bd7dea2b81641f02a2c78a6bb0
|
|
| BLAKE2b-256 |
e49847c41f9eb81deaa274c9e26e2e9655a7a837b5b7645c5583eeb02f571f8d
|
File details
Details for the file swarmauri_crypto_nacl_pkcs11-0.3.0.dev3-py3-none-any.whl.
File metadata
- Download URL: swarmauri_crypto_nacl_pkcs11-0.3.0.dev3-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48ed04b487f26a3f91287484244f85ba5429c377df51eca5c62dd8fb41213648
|
|
| MD5 |
e5f1193e1089258823577947aa3989fc
|
|
| BLAKE2b-256 |
258c3039bb6ff944c602b408609b9eed603d1399edcd357ba77e2494fa377463
|