{"id":24785,"library":"unicrypto","title":"unicrypto","description":"Unified interface for cryptographic libraries in Python. Current version 0.0.12 provides a consistent API across backends like cryptography, pycryptodome, and hashlib. Release cadence is sporadic; last update 2022.","status":"active","version":"0.0.12","language":"python","source_language":"en","source_url":"https://github.com/skelsec/unicrypto","tags":["cryptography","unified-api","aes","rsa","pkcs"],"install":[{"cmd":"pip install unicrypto","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Primary backend for RSA, AES, etc.","package":"cryptography","optional":false},{"reason":"Alternative backend for some ciphers","package":"pycryptodome","optional":true}],"imports":[{"note":"Direct import from unicrypto works.","wrong":null,"symbol":"Cipher","correct":"from unicrypto import Cipher"},{"note":"Common mistake: looking for PKCS1 in symmetric submodule.","wrong":"from unicrypto.symmetric import PKCS1_v1_5 (wrong path)","symbol":"PKCS1_v1_5","correct":"from unicrypto import PKCS1_v1_5"}],"quickstart":{"code":"from unicrypto import Cipher, symmetric\nimport os\n\nkey = os.environ.get('KEY', '00112233445566778899aabbccddeeff')\niv = os.environ.get('IV', 'fedcba9876543210')\ncipher = Cipher(b'aes', key=bytes.fromhex(key), iv=bytes.fromhex(iv))\nplaintext = b'secret message'\nciphertext = cipher.encrypt(plaintext)\nprint(ciphertext.hex())","lang":"python","description":"Encrypt a message using AES-CBC with a key and IV from environment variables."},"warnings":[{"fix":"Use ciphertext.data instead of treating ciphertext as bytes.","message":"Version 0.0.10 changed the return type of Cipher.encrypt from bytes to Ciphertext object. Access bytes via .data property.","severity":"breaking","affected_versions":">=0.0.10"},{"fix":"Use from unicrypto import Cipher; cipher = Cipher('aes', ...)","message":"Many examples use from unicrypto.symmetric import AES which is incorrect; AES is accessed via Cipher with algorithm string 'aes'.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Cipher with padding parameter or rely on default padding.","message":"The PKCS7 padding class is deprecated in favor of integrated padding in Cipher mode.","severity":"deprecated","affected_versions":">=0.0.11"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use from unicrypto import symmetric (this works) or from unicrypto import Cipher.","cause":"Trying to import from a submodule that doesn't exist directly; unicrypto exposes symmetric classes at top level.","error":"ModuleNotFoundError: No module named 'unicrypto.symmetric'"},{"fix":"Use ciphertext.data.hex() instead of ciphertext.hex().","cause":"Cipher.encrypt returns a Ciphertext object, not bytes. You need to access .data to get bytes.","error":"AttributeError: 'Ciphertext' object has no attribute 'hex'"},{"fix":"Ensure key is 16, 24, or 32 bytes for AES-128, AES-192, or AES-256 respectively.","cause":"Provided key length not supported by AES (16, 24, or 32 bytes).","error":"ValueError: Invalid key size for AES"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}