Python SDK for Sevola Encrypt.
Project description
Sevola Encrypt SDK (Python)
Python SDK for Sevola Encrypt API. Ciphertext-interoperable with the .NET SevolaEncryptSdk package.
Install
pip install sevola-encrypt-sdk
Requires Python 3.8+.
Quick start (sync)
from sevola_encrypt_sdk import EncryptClient, EncryptPayload, DecryptPayload
with EncryptClient(api_key="YOUR_KEY", api_url="https://api.sevola.example") as client:
# Transit (AES-CBC)
cipher = client.encrypt_transit("hello world")
plain = client.decrypt_transit(cipher)
# Transit dynamic (per-request key, with x-sevola-traceid suffix)
cipher = client.encrypt_transit_dynamic("hello world")
plain = client.decrypt_transit_dynamic(cipher)
# FF1 bulk (format-preserving encryption)
enc = client.encrypt_data([
EncryptPayload(template="numeric", data="081234567890"),
EncryptPayload(template="alphanumeric", data="JohnDoe"),
])
dec = client.decrypt_data([
DecryptPayload(template="numeric", value=enc[0].value),
DecryptPayload(template="alphanumeric", value=enc[1].value),
])
Quick start (async)
import asyncio
from sevola_encrypt_sdk import AsyncEncryptClient
async def main():
async with AsyncEncryptClient(api_key="YOUR_KEY", api_url="https://api.sevola.example") as client:
cipher = await client.encrypt_transit("hello async")
plain = await client.decrypt_transit(cipher)
print(plain)
asyncio.run(main())
Public API
| Method | Returns | Description |
|---|---|---|
encrypt_transit(plain) |
str |
AES-CBC + PBKDF2 transit cipher (Base64). |
decrypt_transit(cipher) |
str |
Reverse of encrypt_transit. |
encrypt_transit_dynamic(plain) |
str |
Same as transit, key fetched per request. Output ends with x-sevola-traceid=.... |
decrypt_transit_dynamic(cipher) |
str |
Decrypts dynamic transit cipher. |
encrypt_data(payloads) |
list[EncryptResult] |
FF1 bulk encryption (templates: numeric, alphanumeric). |
decrypt_data(payloads) |
list[DecryptResult] |
FF1 bulk decryption. |
clear_cache() |
None |
Clears the in-memory key cache. |
Interoperability with .NET
This SDK reproduces the exact crypto pipeline of the .NET SevolaEncryptSdk:
- Transit: AES-256-CBC with PKCS7. Key derived via PBKDF2-HMAC-SHA256, 1000 iterations, salt
FixedSalt123456, 32-byte output. IV (16 bytes) prepended to ciphertext, output Base64-encoded. - Response decryption: AES-256-GCM. Key = SHA-256(api_key). 12-byte nonce prepended; 16-byte tag appended; output Base64-encoded by server.
- FF1: NIST SP 800-38G — algorithm vendored from
ubiq-security-fpe(MIT licensed) with M2Crypto replaced bycryptographyso installs are dependency-free. The cryptographic logic is byte-identical to upstream and toUbiqSecurity.Fpein .NET. TweakU8dXq2a+1kA=(Base64), radix 10 / alphabet0-9fornumeric, radix 62 / alphabet0-9a-zA-Zforalphanumeric. - Markers: Same
Z9Y/9078family of base, padding, and escape markers.
License
MIT
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
sevola_encrypt_sdk-1.0.0.tar.gz
(19.4 kB
view details)
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 sevola_encrypt_sdk-1.0.0.tar.gz.
File metadata
- Download URL: sevola_encrypt_sdk-1.0.0.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e913ed866766fae56669653b9dbe93825a3fe4034340bbc19bb54b55b01f3ef
|
|
| MD5 |
f1c58927acf04927a55c2b87637bdccd
|
|
| BLAKE2b-256 |
8825fb52dde07a52b15936fa5f377689bcd237764d9da351eef4602c50517850
|
File details
Details for the file sevola_encrypt_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sevola_encrypt_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b618a698adbd8dad1974dcee30c1d68ba007a4284a2d049b0a7735340050df5
|
|
| MD5 |
0bc24687f1e391f4a2142e45d530599d
|
|
| BLAKE2b-256 |
fd9564525055bd6a6049770f80c7ac393077c6ef26652d10caded8acc1c412e7
|