Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add certificate property to check if the certificate is valid or not #31

Closed
xkill opened this issue Nov 15, 2017 · 5 comments
Closed

Add certificate property to check if the certificate is valid or not #31

xkill opened this issue Nov 15, 2017 · 5 comments

Comments

@xkill
Copy link

xkill commented Nov 15, 2017

Hi,

There is no easy way to check if a certificate is valid or not based on expiration date or revoked.

I suggest to add two properties:

"expired": like "revoked" but checking if the cert is expired or not
"valid": return true if not revoked or expired or false if expired or revoked.

@mathiasertl
Copy link
Owner

Hi!

Thanks for your suggestion. I'm not quite sure what area you are talking about. The Model class in the code? The command-line interface? The web interface?

@xkill
Copy link
Author

xkill commented Nov 15, 2017

The Model class.

  • Certificate.revoked # already implemented
  • Certificate.expired:
from datetime import datetime
def expired(self):
    return self.certificate.x509.not_valid_before > datetime.now()
  • Certificate.valid:
def valid(self):
    return self.revoked() or self.expired()

You can also add it on the Admin list view as a boolean property.

@mathiasertl
Copy link
Owner

The latter would mean the certificate is "valid" if it is either revoked or expired. Is that really what you want?

@xkill
Copy link
Author

xkill commented Nov 17, 2017

Yes.

@mathiasertl
Copy link
Owner

However, the opposite is true. A certificate is valid if it is neither revoked nor expired. Thus closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants