X-Git-Url: https://v.licheni.net/stack/cam.git/blobdiff_plain/112c04e3926d62291efd902a1dcb0b2d24feeb59..9a09fbbbe9b12c86d14f89a49830be1883d1e49d:/cam/cert.py diff --git a/cam/cert.py b/cam/cert.py index 9254fb0..9aab798 100644 --- a/cam/cert.py +++ b/cam/cert.py @@ -32,8 +32,11 @@ class Cert(object): self.private_key_file = os.path.join(ca.basedir, 'private', '%s.key' % name) + def exists(self): + return os.path.exists(self.public_key_file) + def get_fingerprint(self, digest='sha1'): - if os.path.exists(self.public_key_file): + if self.exists(): output = openssl_wrap.run('x509', '-in', self.public_key_file, '-noout', '-fingerprint', '-%s' % digest) m = re.search(r'=(.*)$', output) @@ -42,7 +45,7 @@ class Cert(object): return None def get_expiration_date(self): - if os.path.exists(self.public_key_file): + if self.exists(): output = openssl_wrap.run('x509', '-in', self.public_key_file, '-noout', '-dates') m = re.search(r'notAfter=(.*)', output)