How to work with python-m2crypto

This is a little howto on how to understand the m2crypto Python module, beyond the examples provided:

  1. Build the documentation as explained here
  2. Look at the documentation, which does not contain a single comment
  3. Click the links that show the source (for example, of M2Crypto.SMIME.SMIME.verify)
  4. Look what openssl function gets called by the function you are interested in (for example, pkcs7_verifysomething))
  5. Google the name of that openssl function, trying a few variations, until you find the openssl manpage that tells you what it does, in detail (for example, pcks_verify)
  6. Understand what it does, and backport the understanding to the thin convenience layer that m2crypto adds on top of it
  7. Realise that now you also understand the corresponding openssl smime -verify commandline invocation, and that next time instead of reading the openssl manpage you should look at the openssl api docs instead.