Revize 5f4e6c2f
Přidáno uživatelem Stanislav Král před téměř 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import time |
17 | 17 |
|
18 |
DATE_FORMAT = "%d.%m.%Y %H:%M:%S" |
|
18 |
NOT_BEFORE_AFTER_DATE_FORMAT = "%d.%m.%Y %H:%M:%S"
|
|
19 | 19 |
CA_EXTENSIONS = "basicConstraints=critical,CA:TRUE" |
20 | 20 |
CRL_EXTENSION = "crlDistributionPoints=URI:" |
21 | 21 |
OCSP_EXTENSION = "authorityInfoAccess=OCSP;URI:" |
... | ... | |
86 | 86 |
# TODO this could be improved in the future in such way that calling openssl is not required to parse the dates |
87 | 87 |
subj, not_before, not_after = self.cryptography_service.parse_cert_pem(cert_pem) |
88 | 88 |
# format the parsed date |
89 |
not_before_formatted = time.strftime(DATE_FORMAT, not_before) |
|
90 |
not_after_formatted = time.strftime(DATE_FORMAT, not_after) |
|
89 |
not_before_formatted = time.strftime(NOT_BEFORE_AFTER_DATE_FORMAT, not_before)
|
|
90 |
not_after_formatted = time.strftime(NOT_BEFORE_AFTER_DATE_FORMAT, not_after)
|
|
91 | 91 |
|
92 | 92 |
# create a certificate wrapper |
93 | 93 |
certificate = Certificate(-1, subj.common_name, not_before_formatted, not_after_formatted, cert_pem, |
... | ... | |
136 | 136 |
subj, not_before, not_after = self.cryptography_service.parse_cert_pem(cert_pem) |
137 | 137 |
|
138 | 138 |
# format the parsed date |
139 |
not_before_formatted = time.strftime(DATE_FORMAT, not_before) |
|
140 |
not_after_formatted = time.strftime(DATE_FORMAT, not_after) |
|
139 |
not_before_formatted = time.strftime(NOT_BEFORE_AFTER_DATE_FORMAT, not_before)
|
|
140 |
not_after_formatted = time.strftime(NOT_BEFORE_AFTER_DATE_FORMAT, not_after)
|
|
141 | 141 |
|
142 | 142 |
# specify CA usage |
143 | 143 |
usages[CA_ID] = True |
Také k dispozici: Unified diff
Re #8575 - Added a file that defines methods used for generating CA index file lines
Added unit tests verifying the validity of added methods