Install & Compatibility
Where this runs
tested against v1.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 34.4MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.4s · import 0.000s · 35MB
33MB installed
● package 33MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AESCipher
✓ from aes_pkcs5 import AESCipher
✗ from aes_pkcs5 import AESCipher
Initializes an AESCipher with a key and IV, then demonstrates encrypting and decrypting a simple string. The library handles base64 encoding/decoding of the encrypted output automatically.
from aes_pkcs5.algorithms import AESCipher
# Note: Key and IV should be securely generated and managed in production.
# For AES-128, key/IV length must be 16 bytes. For AES-256, 32 bytes.
# The library expects string input for key/IV by default, but bytes are also supported from v1.0.3+
key = 'This is a key123'
iv = 'This is an IV456'
cipher = AESCipher(key, iv)
data_to_encrypt = 'Hello, secure world!'
# Encrypt
encrypted_text = cipher.encrypt(data_to_encrypt)
print(f"Original: {data_to_encrypt}")
print(f"Encrypted (base64 encoded): {encrypted_text}")
# Decrypt
decrypted_text = cipher.decrypt(encrypted_text)
print(f"Decrypted: {decrypted_text}")
Debug
Known issues
breakingPython 3.8 and 3.7 support has been dropped in recent versions. Version 1.0.4 drops Python 3.8 support. Version 1.0.2 dropped Python 3.7 support.fixUpgrade your Python interpreter to 3.9 or higher, or pin to an older `aes-pkcs5` version if you must use an older Python (e.g., `pip install aes-pkcs5==1.0.1` for Python 3.8 compatibility).
affects: >=1.0.2, >=1.0.4
gotchaThis library explicitly implements PKCS5 padding. While often interchangeable with PKCS7 for AES's fixed 16-byte block size, there are technical differences. If you need strict PKCS7 compatibility with other systems, this library might not be suitable without modification or additional handling.fixEnsure that the system you are interoperating with also expects PKCS5 padding. If PKCS7 is required, consider using `pycryptodome` or `cryptography` which offer more explicit padding options.
affects: All versions
gotchaPrior to version 1.0.3, passing `bytes` objects directly for the `key` or `iv` parameters of `AESCipher` could lead to `TypeError` as it primarily expected `str`. While 1.0.3+ supports `bytes`, consistency is key.fixFor versions <1.0.3, ensure `key` and `iv` are `str` (e.g., `key.decode('utf-8')` if starting with bytes). For 1.0.3+, both `str` and `bytes` are accepted, but ensure consistent usage throughout your application. affects: <1.0.3
Upgrade
Version history
1.0.4latest on PyPI · released Apr 26, 2025
Audit
Dependencies
No dependency data recorded yet.