lib_bhpai_crypto - BHPAI Standalone Cryptographic Library
Portable, high-performance Zero-Knowledge & End-to-End Encryption (E2EE) Python Library extracted from BHPAI Vault architecture.
Features
- Key Derivation: Argon2id & PBKDF2-HMAC-SHA256 derivation + HKDF domain separation (
K_master,K_unlock,K_wrap_files,K_wrap_meta). - AEAD Encryption: AES-256-GCM authenticated encryption with CSPRNG 96-bit nonces.
- Binary Canonical AAD: 6-field length-prefixed AAD for C++/Python cross-platform binary compatibility.
- Bucket Size Padding: Application-level padding to obfuscate exact file sizes.
- Envelope Encryption: DEK envelope + file payload envelope wrapping.
Installation / Requirements
- Python 3.8+
cryptographypackage (pip install cryptography)
Usage Example
from lib_bhpai_crypto import BHPAICryptoLib
# 1. Initialize Crypto SDK
client = BHPAICryptoLib(vault_id="user-vault-123")
# 2. Derive Key Tree from Master Password
keys = client.derive_keys(password="UserSecretPassword123!")
k_unlock = keys["k_unlock"]
k_wrap_files = keys["k_wrap_files"]
# 3. Encrypt Arbitrary Data / JSON Payload
sensitive_data = {"account_no": "1234-5678", "token": "abc.xyz"}
envelope = client.encrypt_data(data=sensitive_data, key=k_unlock)
print("Encrypted Envelope:", envelope)
# 4. Decrypt Data Payload
decrypted_bytes = client.decrypt_data(envelope=envelope, key=k_unlock)
print("Decrypted Data:", decrypted_bytes.decode('utf-8'))
# 5. Encrypt Raw File Bytes (with DEK envelope + bucket size padding)
sample_file_bytes = b"Secret PDF content or image bytes..."
dek_envelope, file_envelope = client.encrypt_file(
file_bytes=sample_file_bytes,
k_wrap_files=k_wrap_files
)
# 6. Decrypt File Bytes
original_bytes = client.decrypt_file(
dek_envelope=dek_envelope,
file_envelope=file_envelope,
k_wrap_files=k_wrap_files
)
assert original_bytes == sample_file_bytes
print("File decryption successful!")
Metadata
Release files for BHPAICrypto 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bhpaicrypto-1.0.0.tar.gz | 20.1 kB | Without provenance | Details for bhpaicrypto-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bhpaicrypto-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for bhpaicrypto-1.0.0-py3-none-any.whl |
Total release size: 32.7 kB
Release files / bhpaicrypto-1.0.0.tar.gz
| Download URL | bhpaicrypto-1.0.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98ebd7e756dab81db6ca77f9e9e0c30b718fe31cf1d27bad7c2d2cd745b340f2
|
|
BLAKE2b-256 checksum How to use checksums |
2712153d7fd52e71de7ab977a30d0f3a2032ac4f9fdcfb83d94ba7130adf4776
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Release files / bhpaicrypto-1.0.0-py3-none-any.whl
| Download URL | bhpaicrypto-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52d023745bb7763c85857f67c0beeb4d801d4f075c95d68f3c8e8eef7be35499
|
|
BLAKE2b-256 checksum How to use checksums |
08f84821593e03970c0be5d37765e41be502f8c65e7db560549f05bca52e7ad4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Security for BHPAICrypto 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.