add ca.verify tests
[stack/cam.git] / cam / ca.py
index 043cc7e..f906819 100644 (file)
--- a/cam/ca.py
+++ b/cam/ca.py
@@ -156,6 +156,15 @@ class CA(object):
             '-key', self._getpw())
         self.gencrl()
 
+    def verify(self, path):
+        log.info('verifying certificate %s', path)
+        args = ['verify', '-CAfile', self.files.public_key, path]
+        try:
+            openssl_wrap.run(*args, CAROOT=os.path.abspath(self.basedir))
+        except openssl_wrap.CommandError:
+            return False
+        return True
+
     def generate(self, cert):
         self._update_config()