Revize 894cc2cd
Přidáno uživatelem David Friesecký před téměř 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
113 | 113 |
not_after_formatted = time.strftime(VALID_FROM_TO_DATE_FORMAT, not_after) |
114 | 114 |
|
115 | 115 |
# create a certificate wrapper |
116 |
certificate = Certificate(-1, subj.common_name, not_before_formatted, not_after_formatted, cert_pem, |
|
117 |
private_key_id, cert_type, parent_id, usages) |
|
116 |
certificate = Certificate(-1, not_before_formatted, not_after_formatted, cert_pem, cert_type, parent_id, |
|
117 |
private_key_id, usages, subj.common_name, subj.country, subj.locality, subj.state, |
|
118 |
subj.organization, subj.organization_unit, subj.email_address) |
|
118 | 119 |
|
119 | 120 |
return certificate |
120 | 121 |
|
... | ... | |
158 | 159 |
sn=cert_id) |
159 | 160 |
|
160 | 161 |
# wrap into Certificate class |
161 |
self.__create_wrapper(cert_pem, subject_key.private_key_id, usages, |
|
162 |
issuer_cert.certificate_id, INTERMEDIATE_CA_ID) |
|
163 |
|
|
164 |
# parse the generated pem for subject and notBefore/notAfter fields |
|
165 |
subj, not_before, not_after = self.cryptography_service.parse_cert_pem(cert_pem) |
|
166 |
|
|
167 |
# format the parsed date |
|
168 |
not_before_formatted = time.strftime(VALID_FROM_TO_DATE_FORMAT, not_before) |
|
169 |
not_after_formatted = time.strftime(VALID_FROM_TO_DATE_FORMAT, not_after) |
|
170 |
|
|
171 |
# create a certificate wrapper |
|
172 |
certificate = Certificate(-1, subject.common_name, not_before_formatted, not_after_formatted, cert_pem, |
|
173 |
subject_key.private_key_id, INTERMEDIATE_CA_ID, issuer_cert.certificate_id, usages) |
|
162 |
certificate = self.__create_wrapper(cert_pem, subject_key.private_key_id, usages, |
|
163 |
issuer_cert.certificate_id, INTERMEDIATE_CA_ID) |
|
174 | 164 |
|
175 | 165 |
# store the wrapper into the repository |
176 | 166 |
created_id = self.certificate_repository.create(certificate) |
... | ... | |
405 | 395 |
|
406 | 396 |
Logger.debug("Function launched.") |
407 | 397 |
|
408 |
(subject, _, _) = self.cryptography_service.parse_cert_pem(certificate.pem_data) |
|
398 |
subject = Subject(certificate.common_name, |
|
399 |
certificate.country_code, |
|
400 |
certificate.locality, |
|
401 |
certificate.province, |
|
402 |
certificate.organization, |
|
403 |
certificate.organizational_unit, |
|
404 |
certificate.email_address) |
|
409 | 405 |
return subject |
410 | 406 |
|
411 | 407 |
def get_public_key_from_certificate(self, certificate: Certificate): |
Také k dispozici: Unified diff
Re #8590 - Modified methods due to fields of subject implemented