test.py 319 B

12345678910111213
  1. import sys
  2. from m2ext import SSL
  3. from M2Crypto import X509
  4. print "Validating certificate %s using CApath %s" % (sys.argv[1], sys.argv[2])
  5. cert = X509.load_cert(sys.argv[1])
  6. ctx = SSL.Context()
  7. ctx.load_verify_locations(capath=sys.argv[2])
  8. if ctx.validate_certificate(cert):
  9. print "valid"
  10. else:
  11. print "invalid"