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 miscreantVerified import paths — ran on the pinned version, not inferred.
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.
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.
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.
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.
This status, combined with the 'abandoned' status, strongly advises against using this library for new projects or in production environments.
Install the library using pip: `pip install miscreant`
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).
Pass a valid key during the cipher initialization, for example: `cipher = miscreant.aes.siv.AES_SIV(key=my_32_or_64_byte_key)`
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.