Revize 2f5101f1
Přidáno uživatelem Stanislav Král před asi 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
21 | 21 |
|
22 | 22 |
# TODO usages present in method parameters but not in class diagram |
23 | 23 |
def create_root_ca(self, key: PrivateKey, subject: Subject, extensions: str = "", config: str = "", |
24 |
usages=None): |
|
24 |
usages=None, days=30):
|
|
25 | 25 |
""" |
26 | 26 |
Creates a root CA certificate based on the given parameters. |
27 | 27 |
:param key: Private key to be used when generating the certificate |
... | ... | |
29 | 29 |
:param config: String containing the configuration to be used |
30 | 30 |
:param extensions: Name of the section in the configuration representing extensions |
31 | 31 |
:param usages: A dictionary containing usages of the certificate to be generated (see constants.py) |
32 |
:param days: Number of days for which the generated cert. will be considered valid |
|
32 | 33 |
:return: An instance of Certificate class representing the generated root CA cert |
33 | 34 |
""" |
34 | 35 |
if usages is None: |
... | ... | |
36 | 37 |
|
37 | 38 |
# create a new self signed certificate |
38 | 39 |
cert_pem = self.cryptography_service.create_sscrt(subject, key.private_key, key_pass=key.password, |
39 |
extensions=extensions, config=config) |
|
40 |
extensions=extensions, config=config, days=days)
|
|
40 | 41 |
# specify CA usage |
41 | 42 |
usages[CA_ID] = True |
42 | 43 |
|
Také k dispozici: Unified diff
Re #8472 - Added a parameter to the craete_sscrt method in CryptographyService in order to be able to specify tha number of days for which the generated certificate will be valid.