So I was almost there:
import base64 from M2Crypto import SMIME, X509, BIO raw_sig = """base64 PKCS7 envelop""" msg = "challenge message to verify" sm_obj = SMIME.SMIME() x509 = X509.load_cert('ISSUER.crt')
Then you might also be interested in checking CRL and OCSP:
from os.path import basename import re from tempfile import NamedTemporaryFile try: from subprocess import check_output, CalledProcessError, STDOUT except ImportError:
cert_parent - the file with ROOT.crt and ISSUER.crt are merged together. cert_parent_crl - file with ROOT.crt, ISSUER.crt and CRL combined together.
To reconcile the CRL with another certificate, I use:
rm FILE.crl wget http://URL/FILE.crl cat ROOT_ISSUER.crt > ROOT_ISSUER_CRL.crt echo "-----BEGIN X509 CRL-----" >> ROOT_ISSUER_CRL.crt openssl enc -base64 -in FILE.crl >> ROOT_ISSUER_CRL.crt echo "-----END X509 CRL-----" >> ROOT_ISSUER_CRL.crt
Natim source share