--- id: m2crypto version: "0.48.0" license: BSD-2-Clause license_treatment: permissive maintenance: active --- # M2Crypto — A Python crypto and SSL toolkit License: permissive · Maintenance: active · Downloads: 264.0K/mo ## What it is and what it does M2Crypto is a Python wrapper around OpenSSL that exposes cryptographic operations and TLS functionality through a high-level API. It provides RSA, DSA, DH key generation and operations, symmetric ciphers (including AES), HMAC and message digest functions, and full TLS client/server implementation. It also extends Python's standard httplib, urllib, and xmlrpclib with HTTPS support, and includes S/MIME v2 messaging and FTP/TLS capabilities. The library has been in maintenance mode since 2014 and is actively maintained but explicitly recommended only for existing applications. The maintainer directs new projects toward more modern alternatives. M2Crypto depends only on packaging at runtime and requires OpenSSL headers and a C compiler to install; prebuilt wheels exist for recent Python versions on Windows. Use it for: - Migrate legacy Python applications that already use M2Crypto for TLS and cryptographic operations without rewriting. - Implement HTTPS clients or servers when you need direct OpenSSL control and already have M2Crypto in your codebase. - Add HMAC-based session management (AuthCookies) to web applications requiring unforgeable authentication tokens. - Perform RSA or DSA key generation and cryptographic operations in systems where OpenSSL interoperability is critical. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. M2Crypto wraps OpenSSL via SWIG to provide Python access to cryptographic primitives (RSA, DSA, AES, HMAC), TLS client/server implementation, and HTTPS extensions. Yes, but with conditions. Install M2Crypto only if you are maintaining existing code that already depends on it or if you need direct OpenSSL interoperability that modern alternatives do not provide. Do not use it for new projects—the maintainer explicitly recommends alternatives instead. Medium install friction (compiled extension) is acceptable for established deployments. No known vulnerabilities and permissive licensing support continued use. ## Install pip install m2crypto uv add m2crypto poetry add m2crypto ## Installing M2Crypto Before you install: Medium install friction due to compiled C extension requiring OpenSSL headers and build tools. Active maintenance with recent release (83 days old), though explicitly in maintenance mode since 2014—suitable for existing deployments but new projects should consider alternatives. License in practice: BSD-2-Clause is permissive; you may use, modify, and distribute M2Crypto freely in commercial and private projects with minimal restrictions. Quickstart: pip install m2crypto from M2Crypto import BIO, RSA key = RSA.gen_key() Requires OpenSSL development headers and a C compiler; on Windows prebuilt wheels are available for Python 3.10–3.14. Verify before relying: - Whether the library's documented memory-leak caveats and lack of key-clearing features pose practical risks for your use case. - Current state of the SWIG bindings and whether all OpenSSL features you need are exposed. - Specific key generation parameters and their defaults for RSA and DSA operations. ## Package facts - License: BSD-2-Clause (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 264.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python openssl wrapper, tls ssl client server, rsa dsa encryption python, hmac message digest, cryptography toolkit openssl, openssl-wrapper, legacy-maintenance, tls-implementation [View on SkillFed](https://skillfed.io/packages/m2crypto) · [View on PyPI](https://pypi.org/project/m2crypto/)