Adding additional reporting and refactoring existing setup. (#620)

This commit is contained in:
kevgliss
2016-12-20 12:48:14 -08:00
committed by GitHub
parent 9ac10a97ce
commit beba2ba092
6 changed files with 148 additions and 102 deletions

View File

@ -158,6 +158,14 @@ class Certificate(db.Model):
if isinstance(cert.public_key(), rsa.RSAPublicKey):
return 'RSA{key_size}'.format(key_size=cert.public_key().key_size)
@property
def validity_remaining(self):
return abs(self.not_after - arrow.utcnow())
@property
def validity_range(self):
return self.not_after - self.not_before
@hybrid_property
def expired(self):
if self.not_after <= arrow.utcnow():