Revize c839facb
Přidáno uživatelem Michal Seják před téměř 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
333 | 333 |
if not self.certificate_repository.delete(cert.certificate_id): |
334 | 334 |
Logger.error(f"The certificate has not been deleted 'ID = {cert.certificate_id}'.") |
335 | 335 |
|
336 |
|
|
337 |
def get_certificates_issued_by(self, unique_id): |
|
336 |
def get_certificates_issued_by(self, issuer_id): |
|
338 | 337 |
""" |
339 | 338 |
Returns a list of all children of a certificate identified by an unique_id. |
340 | 339 |
Raises a DatabaseException should any unexpected behavior occur. |
341 |
:param unique_id: target certificate ID
|
|
340 |
:param issuer_id: target certificate ID
|
|
342 | 341 |
:return: children of unique_id |
343 | 342 |
""" |
344 | 343 |
|
345 | 344 |
Logger.debug("Function launched.") |
346 | 345 |
|
347 | 346 |
try: |
348 |
if self.certificate_repository.read(unique_id) is None:
|
|
349 |
Logger.error(f"No such certificate found 'ID = {unique_id}'.")
|
|
350 |
raise CertificateNotFoundException(unique_id)
|
|
347 |
if self.certificate_repository.read(issuer_id) is None:
|
|
348 |
Logger.error(f"No such certificate found 'ID = {issuer_id}'.")
|
|
349 |
raise CertificateNotFoundException(issuer_id)
|
|
351 | 350 |
except DatabaseException: |
352 |
Logger.error(f"No such certificate found 'ID = {unique_id}'.") |
|
353 |
raise CertificateNotFoundException(unique_id) |
|
351 |
Logger.error(f"No such certificate found 'ID = {issuer_id}'.") |
|
352 |
raise CertificateNotFoundException(issuer_id) |
|
353 |
|
|
354 |
return self.certificate_repository.get_all_issued_by(issuer_id) |
|
354 | 355 |
|
355 |
return self.certificate_repository.get_all_issued_by(unique_id) |
|
356 |
def get_certificates_issued_by_filter(self, issuer_id, target_types, target_usages, target_cn_substring, page, |
|
357 |
per_page): |
|
358 |
""" |
|
359 |
Returns a list of all children of a certificate identified by an unique_id. |
|
360 |
Filters the results according to target types, usages, cn substring and pagination. |
|
361 |
Raises a DatabaseException should any unexpected behavior occur. |
|
362 |
:param issuer_id: target certificate ID |
|
363 |
:param target_types: filter of types |
|
364 |
:param target_usages: filter of usages |
|
365 |
:param target_cn_substring: CN substring |
|
366 |
:param page: target page or None |
|
367 |
:param per_page: certs per page or None |
|
368 |
:return: list of certificates (a page if specified) |
|
369 |
""" |
|
370 |
|
|
371 |
Logger.debug("Function launched.") |
|
372 |
|
|
373 |
try: |
|
374 |
if self.certificate_repository.read(issuer_id) is None: |
|
375 |
Logger.error(f"No such certificate found 'ID = {issuer_id}'.") |
|
376 |
raise CertificateNotFoundException(issuer_id) |
|
377 |
except DatabaseException: |
|
378 |
Logger.error(f"No such certificate found 'ID = {issuer_id}'.") |
|
379 |
raise CertificateNotFoundException(issuer_id) |
|
356 | 380 |
|
357 | 381 |
def set_certificate_revocation_status(self, id, status, reason="unspecified"): |
358 | 382 |
""" |
... | ... | |
463 | 487 |
|
464 | 488 |
return status |
465 | 489 |
|
466 |
|
|
467 | 490 |
def __get_crl_endpoint(self, ca_identifier: int) -> str: |
468 | 491 |
""" |
469 | 492 |
Get URL address of CRL distribution endpoint based on |
... | ... | |
490 | 513 |
|
491 | 514 |
return self.configuration.base_server_url + "/api/ocsp/" + str(ca_identifier) |
492 | 515 |
|
493 |
|
|
494 | 516 |
class RevocationReasonInvalidException(Exception): |
495 | 517 |
""" |
496 | 518 |
Exception that denotes that the caller was trying to revoke |
Také k dispozici: Unified diff
Re #8702 - Started implementing required CertService updates.