Revize 485913d0
Přidáno uživatelem Michal Seják před téměř 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
6 | 6 |
from src.constants import ROOT_CA_ID, INTERMEDIATE_CA_ID, CA_ID, CERTIFICATE_ID, CERTIFICATE_STATES, \ |
7 | 7 |
CERTIFICATE_REVOCATION_REASONS |
8 | 8 |
from src.dao.certificate_repository import CertificateRepository |
9 |
from src.exceptions.database_exception import DatabaseException |
|
9 | 10 |
from src.exceptions.unknown_exception import UnknownException |
10 | 11 |
from src.model.certificate import Certificate |
11 | 12 |
from src.model.private_key import PrivateKey |
... | ... | |
267 | 268 |
# TODO delete children? |
268 | 269 |
return self.certificate_repository.delete(unique_id) |
269 | 270 |
|
271 |
def get_certificates_issued_by(self, unique_id): |
|
272 |
""" |
|
273 |
Returns a list of all children of a certificate identified by an unique_id. |
|
274 |
Raises a DatabaseException should any unexpected behavior occur. |
|
275 |
:param unique_id: target certificate ID |
|
276 |
:return: children of unique_id |
|
277 |
""" |
|
278 |
try: |
|
279 |
if self.certificate_repository.read(unique_id) is None: |
|
280 |
raise CertificateNotFoundException(unique_id) |
|
281 |
except DatabaseException: |
|
282 |
raise CertificateNotFoundException(unique_id) |
|
283 |
|
|
284 |
return self.certificate_repository.get_all_issued_by(unique_id) |
|
285 |
|
|
270 | 286 |
def set_certificate_revocation_status(self, id, status, reason="unspecified"): |
271 | 287 |
""" |
272 | 288 |
Set certificate status to 'valid' or 'revoked'. |
Také k dispozici: Unified diff
Re #8574 - Added the `get_certificates_issued_by(id)` method to the CertificateService (just calling the homonymous CryptoService method).