Registry / auth-security / miscreant

miscreant

JSON →
library0.3.0pypypi✓ verified 22d ago

Miscreant.py is a Python implementation of the Miscreant advanced symmetric encryption library, providing AES-SIV (RFC 5297), AES-PMAC-SIV, and STREAM constructions. These algorithms offer misuse-resistant authenticated encryption, particularly AES-SIV, which prevents catastrophic failures from nonce reuse. The last stable version is 0.3.0, released in December 2017, and the project is effectively unmaintained.

pip install miscreant
INSTALL
IMPORT
SIG · MISCREANT
M
miscreant
auth-securitypythonv0.3.0
Install
3.3s avg
Import
31ms
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · 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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.032s · 36.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.3s · import 0.030s · 37MB
34MB installed
● package 34MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SIV
from miscreant.aes.siv import SIV
The primary interface for AES-SIV encryption.

This quickstart demonstrates how to initialize the AES-SIV cipher, encrypt a plaintext message with associated data, and then decrypt it. Note the requirement for a key of 32 or 64 bytes.

import os from miscreant.aes.siv import SIV # AES-SIV requires a key twice the size of a standard AES key (e.g., 32 or 64 bytes) # For a 128-bit AES-SIV key, generate 32 bytes (2 * 16 bytes) key = os.urandom(32) siv = SIV(key) plaintext = b"This is my secret message!" # Associated data (AD) is authenticated but not encrypted associated_data = [b"header1", b"header2"] # Encrypt (seal) the message ciphertext = siv.seal(plaintext, ad=associated_data) print(f"Ciphertext: {ciphertext.hex()}") # Decrypt (open) the message try: decrypted_plaintext = siv.open(ciphertext, ad=associated_data) print(f"Decrypted: {decrypted_plaintext.decode()}") except Exception as e: print(f"Decryption failed: {e}")
Debug
Known issues
breakingThe Miscreant Python repository is marked as 'Public archive' on GitHub, indicating that it is no longer actively maintained. No further development, bug fixes, or security patches are expected.
fix
Users should carefully evaluate the risks of using an unmaintained cryptography library. Consider migrating to actively maintained alternatives like 'cryptography' (Fernet) or 'libsodium' wrappers if possible.
affects: 0.3.0 and earlier
gotchaSome portions of the Miscreant implementation (specifically `s2v` and `dbl` functions) are in pure Python and are NOT constant time. This means they may be vulnerable to timing attacks that could reveal sensitive information, potentially leading to plaintext recovery.
fix
The library explicitly warns 'Use this library at your own risk. This library has not been professionally audited by cryptography experts.' It is not recommended for high-security applications without a thorough independent audit.
affects: 0.3.0 and earlier
gotchaThe AES-SIV construction requires a key that is twice the size of a standard AES key (e.g., 32 bytes for AES-128 SIV, or 64 bytes for AES-256 SIV). Passing an incorrectly sized key will result in an error or insecure operation.
fix
Ensure your key is 32 bytes for AES-128 SIV or 64 bytes for AES-256 SIV. For example, `os.urandom(32)` for a 128-bit SIV key.
affects: 0.3.0 and earlier
gotchaThe PyPI project for miscreant (version 0.3.0) is still classified with a 'Development Status :: 2 - Pre-Alpha'. This indicates that it was never considered stable or production-ready by its maintainers, even at its last release.
fix
This status, combined with the 'abandoned' status, strongly advises against using this library for new projects or in production environments.
affects: 0.3.0 and earlier
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'miscreant'
The 'miscreant' library is not installed in the Python environment, or the Python interpreter cannot find it in its search path.
fix
Install the library using pip: `pip install miscreant`
ValueError: Key must be 32 or 64 bytes
The AES-SIV construction used by Miscreant requires a key that is precisely 32 bytes (for AES-128 SIV) or 64 bytes (for AES-256 SIV). An incorrect key length is provided.
fix
Generate or provide a key of the correct byte length (e.g., `os.urandom(32)` for a 128-bit SIV key or `os.urandom(64)` for a 256-bit SIV key).
TypeError: __init__() missing 1 required positional argument: 'key'
When initializing a Miscreant cipher (e.g., `miscreant.aes.siv.AES_SIV`), the required 'key' argument was not provided.
fix
Pass a valid key during the cipher initialization, for example: `cipher = miscreant.aes.siv.AES_SIV(key=my_32_or_64_byte_key)`
ValueError: Tag mismatch!
During decryption, the authenticated encryption tag computed from the ciphertext and associated data does not match the expected tag, indicating either data tampering, incorrect associated data, or an incorrect key.
fix
Ensure that the same key and associated data (if any) used during encryption are provided during decryption, and that the ciphertext has not been altered. If the data is expected to be valid, double-check all input parameters to the `open` method.
Upgrade
Version history
0.3.0latest on PyPI · released Dec 25, 2017
Audit
Dependencies
cryptographyrequiredProvides core cryptographic primitives for Miscreant's constructions.
Agent activity
14 hits · last 30 days
node
10
OpenAI (training)
1
Resources
miscreant — pip install miscreant · libregistry