bugfix - m2crypto verification function returns
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 17 Dec 2015 10:44:02 +0000 (11:44 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 17 Dec 2015 10:44:02 +0000 (11:44 +0100)
. 1 in case of success
. but otherwise it may be 0 or -1

sfa/trust/certificate.py

index 6082d92..ff6534e 100644 (file)
@@ -680,7 +680,9 @@ class Certificate:
         m2x509 = X509.load_cert_string(self.save_to_string())
         m2pubkey = pubkey.get_m2_pubkey()
         # verify it
-        return m2x509.verify(m2pubkey)
+        # verify returns -1 or 0 on failure depending on how serious the
+        # error conditions are
+        return m2x509.verify(m2pubkey) == 1
 
         # XXX alternatively, if openssl has been patched, do the much simpler:
         # try: