Paramiko-backed RSA + AES-GCM crypto provider for Swarmauri
Project description
Swarmauri Crypto Paramiko
Paramiko-backed crypto provider implementing the ICrypto contract via CryptoBase.
- AES-256-GCM symmetric encrypt/decrypt
- RSA-OAEP(SHA-256) wrap/unwrap
- Multi-recipient hybrid envelopes using OpenSSH public keys
Installation
pip install swarmauri_crypto_paramiko
Usage
Symmetric AEAD Encryption
from swarmauri_crypto_paramiko import ParamikoCrypto
from swarmauri_core.crypto.types import KeyRef, KeyType, KeyUse, ExportPolicy
crypto = ParamikoCrypto()
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)
RSA Key Wrapping/Unwrapping
import paramiko
from cryptography.hazmat.primitives import serialization
from swarmauri_core.crypto.types import KeyRef, KeyType, KeyUse, ExportPolicy
crypto = ParamikoCrypto()
key = paramiko.RSAKey.generate(2048)
pub_line = f"{key.get_name()} {key.get_base64()}\n".encode()
priv_pem = key.key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.PKCS8,
encryption_algorithm=serialization.NoEncryption(),
)
recipient = KeyRef(
kid="rsa1",
version=1,
type=KeyType.RSA,
uses=(KeyUse.WRAP, KeyUse.UNWRAP),
export_policy=ExportPolicy.PUBLIC_ONLY,
public=pub_line,
material=priv_pem,
)
wrapped = await crypto.wrap(recipient)
unwrapped = await crypto.unwrap(recipient, wrapped)
Hybrid Envelope for Multiple Recipients
env = await crypto.encrypt_for_many([recipient], b"secret")
Entry point
The provider is registered under the swarmauri.cryptos entry-point as ParamikoCrypto.
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_paramiko-0.3.0.dev4.tar.gz.
File metadata
- Download URL: swarmauri_crypto_paramiko-0.3.0.dev4.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56125ba0fd8dc5cc1ce4d1928dbbb35438be8ac7148864dcedae9fe204ef056a
|
|
| MD5 |
0f92099be926932105f7a0176773e284
|
|
| BLAKE2b-256 |
4cbed225860590d3e898bc26d2699aefc385e6524b65f591822a891aec9c4eaa
|
File details
Details for the file swarmauri_crypto_paramiko-0.3.0.dev4-py3-none-any.whl.
File metadata
- Download URL: swarmauri_crypto_paramiko-0.3.0.dev4-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7124a4de7c4114c5a044d3faf1be9575f283b0e24b3683e314a34d0621b307cc
|
|
| MD5 |
86f8b65f93b0e4b3927bc7ee669f24c3
|
|
| BLAKE2b-256 |
ef93d6f4da4c2b108cfd3b4bd69800ffac9428f1d4323b09e48a9ad03cba5821
|