/usr/share/pyshared/m2ext/SSL.py is in python-m2ext 0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from M2Crypto import SSL, X509
import _m2ext
class Context(SSL.Context):
def validate_certificate(self, cert):
"""
Validate a certificate using this SSL Context
"""
store_ctx = X509.X509_Store_Context(_m2ext.x509_store_ctx_new(), _pyfree=1)
_m2ext.x509_store_ctx_init(store_ctx.ctx,
self.get_cert_store().store,
cert.x509, None)
rc = _m2ext.x509_verify_cert(store_ctx.ctx)
if rc < 0:
raise SSL.SSLError("Empty context")
return rc != 0
|