This release is a pre-release and may not be stable for production use.
Swarmauri MRE Crypto ECDH-ES+A128KW
ECDH-ES+A128KW based multi-recipient encryption provider implementing the IMreCrypto contract.
Capabilities
- Per-recipient ECDH-ES key agreement over
secp256r1 - AES-128 Key Wrap (KW) of the derived content-encryption key
- AES-128-GCM payload encryption with optional additional authenticated data (AAD)
- Supported payload algorithm:
A128GCM - Supported recipient algorithm:
ECDH-ES+A128KW - Supported MRE mode:
MreMode.ENC_ONCE_HEADERS - Re-wrapping existing envelopes is not supported
Installation
pip
pip install swarmauri_mre_crypto_ecdh_es_kw
Poetry
poetry add swarmauri_mre_crypto_ecdh_es_kw
uv
-
Install
uvif it is not already available:curl -LsSf https://astral.sh/uv/install.sh | sh
-
Add the package to your environment:
uv pip install swarmauri_mre_crypto_ecdh_es_kw
Usage
The provider operates asynchronously. The example below demonstrates encrypting and decrypting a payload for a single
recipient whose key is provided as a cryptography object reference. The same aad (if provided) must be used for
both encryption and decryption.
import asyncio
from cryptography.hazmat.primitives.asymmetric import ec
from swarmauri_mre_crypto_ecdh_es_kw import EcdhEsA128KwMreCrypto
async def main() -> None:
crypto = EcdhEsA128KwMreCrypto()
sk = ec.generate_private_key(ec.SECP256R1())
pk = sk.public_key()
recipient = {"kid": "1", "version": 1, "kind": "cryptography_obj", "obj": pk}
envelope = await crypto.encrypt_for_many([recipient], b"secret", aad=b"metadata")
plaintext = await crypto.open_for(
{"kind": "cryptography_obj", "obj": sk}, envelope, aad=b"metadata"
)
assert plaintext == b"secret"
if __name__ == "__main__":
asyncio.run(main())
Entry point
The provider is registered under the swarmauri.mre_cryptos entry point as EcdhEsA128KwMreCrypto.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_mre_crypto_ecdh_es_kw 0.11.0.dev1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_mre_crypto_ecdh_es_kw-0.11.0.dev1.tar.gz | 8.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_mre_crypto_ecdh_es_kw-0.11.0.dev1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.2 kB
Release files / swarmauri_mre_crypto_ecdh_es_kw-0.11.0.dev1.tar.gz
| Download URL | swarmauri_mre_crypto_ecdh_es_kw-0.11.0.dev1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
648848a23cef1e205437a26fa4921efc7d187f973d5d2e269c4b7bf4b214fbfa
|
|
BLAKE2b-256 checksum How to use checksums |
12719a09823377a5365cd70d19acbd8d22eb891842b6ba7229c906c97238d014
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_mre_crypto_ecdh_es_kw-0.11.0.dev1-py3-none-any.whl
| Download URL | swarmauri_mre_crypto_ecdh_es_kw-0.11.0.dev1-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfb31bed0abd1b1c7223004a1a8f52023412265725c985f40a0c21d09e0e1b57
|
|
BLAKE2b-256 checksum How to use checksums |
2e8a33bb4591934ee47636f61919319b47f8a04d34abacc5b51350ce2b0f06c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|