Revize 04805a41
Přidáno uživatelem Stanislav Král před téměř 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
477 | 477 |
|
478 | 478 |
return self.configuration.base_server_url + "/api/ocsp/" + str(ca_identifier) |
479 | 479 |
|
480 |
def generate_pkcs_identity(self, cert_id: int, cert_key: PrivateKey, identity_name: str, identity_passphrase: str):
|
|
480 |
def generate_pkcs_identity(self, certificate: Certificate, cert_key: PrivateKey, identity_name: str, identity_passphrase: str):
|
|
481 | 481 |
""" |
482 | 482 |
Generates a PKCS identity of the certificate given by the specified ID while using the private key passed. |
483 | 483 |
A name of the identity to be used and certificate's passphrase have to be specified as well as the passphrase |
484 | 484 |
of certificate's private key (if encrypted). |
485 |
:param cert_id: ID of the certificate to be put into the PKCS identity store
|
|
485 |
:param certificate: certificate to be put into the PKCS identity store
|
|
486 | 486 |
:param cert_key: key used to sign the given certificate |
487 | 487 |
:param identity_name: name to be given to the identity to be created |
488 | 488 |
:param identity_passphrase: passphrase to be used to encrypt the identity |
... | ... | |
490 | 490 |
""" |
491 | 491 |
Logger.debug("Function launched.") |
492 | 492 |
|
493 |
# Read the selected certificate from the repository |
|
494 |
certificate = self.certificate_repository.read(cert_id) |
|
495 |
if certificate is None: |
|
496 |
Logger.error("Certificate whose identity should be generated does not exist.") |
|
497 |
raise CertificateNotFoundException(cert_id) |
|
498 |
|
|
499 | 493 |
# get the chain of trust of the certificate whose identity should be generated and exclude the certificate |
500 | 494 |
# whose chain of trust we are querying |
501 |
cot_pem_list = [cert.pem_data for cert in self.get_chain_of_trust(cert_id, exclude_root=False)[1:]] |
|
495 |
cot_pem_list = [cert.pem_data for cert in self.get_chain_of_trust(certificate.certificate_id, exclude_root=False)[1:]]
|
|
502 | 496 |
|
503 | 497 |
return self.cryptography_service.generate_pkcs_identity(certificate.pem_data, cert_key.private_key, |
504 | 498 |
identity_name, |
Také k dispozici: Unified diff
Re #8708 - Changed the generate_pkcs_identity method of the CertificateService in such way that the Certificate class instance is now passed instead of a certificate ID resulting in a decrease of SQL queries.