From 905dfa88fb5ef5fc520b98cf5186c7c77c5c306e Mon Sep 17 00:00:00 2001 From: peppelinux Date: Tue, 25 Jan 2022 16:26:16 +0100 Subject: [PATCH] feat: validate if a cert is expired --- spid_compliant_certificates/validator/checks/__init__.py | 3 +++ spid_compliant_certificates/validator/validate.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/spid_compliant_certificates/validator/checks/__init__.py b/spid_compliant_certificates/validator/checks/__init__.py index 955ed7d..e8e37f2 100644 --- a/spid_compliant_certificates/validator/checks/__init__.py +++ b/spid_compliant_certificates/validator/checks/__init__.py @@ -30,6 +30,8 @@ key_usage # noqa from spid_compliant_certificates.validator.checks.subject_dn import \ subject_dn # noqa +from spid_compliant_certificates.validator.checks.time_validity import \ + not_expired # noqa _all_ = [ 'basic_constraints', @@ -38,4 +40,5 @@ 'key_type_and_size', 'key_usage', 'subject_dn', + 'not_expired' ] diff --git a/spid_compliant_certificates/validator/validate.py b/spid_compliant_certificates/validator/validate.py index ffec17a..bb79cb9 100644 --- a/spid_compliant_certificates/validator/validate.py +++ b/spid_compliant_certificates/validator/validate.py @@ -63,6 +63,12 @@ def validate(crt_file: str, sector: str) -> Report: 'Checking the SubjectDN' )) + # check time + rep.add_test(_do_check( + checks.not_expired(crt), + 'Checking that the certificates is not expired' + )) + # check basicConstraints _ext_msg = 'Checking basicConstraints x509 extension' try: