Revize 35a4e794
Přidáno uživatelem Stanislav Král před téměř 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
51 | 51 |
|
52 | 52 |
@staticmethod |
53 | 53 |
def __check_subject_is_valid(subject: Subject): |
54 |
""" |
|
55 |
Checks whether the given subject is valid |
|
56 |
:param subject: A subject to be verified |
|
57 |
:raises InvalidCertificateAttribute: When a subject with an invalid attribute is passed |
|
58 |
""" |
|
54 | 59 |
if subject.country is not None and len(subject.country) != 2: |
55 | 60 |
raise InvalidSubjectAttribute("Country code", "Must consist of exactly 2 letters.") |
56 | 61 |
|
... | ... | |
65 | 70 |
:param extensions: Name of the section in the configuration representing extensions |
66 | 71 |
:param usages: A dictionary containing usages of the certificate to be generated (see constants.py) |
67 | 72 |
:param days: Number of days for which the generated cert. will be considered valid |
73 |
:raises InvalidCertificateAttribute: when a subject with an invalid attribute is passed |
|
68 | 74 |
:return: An instance of Certificate class representing the generated root CA cert |
69 | 75 |
""" |
70 | 76 |
|
... | ... | |
140 | 146 |
:param extensions: Extensions to be used when generating the certificate |
141 | 147 |
:param usages: A dictionary containing usages of the certificate to be generated (see constants.py) |
142 | 148 |
:param days: Number of days for which the generated cert. will be considered valid |
149 |
:raises InvalidCertificateAttribute: when a subject with an invalid attribute is passed |
|
143 | 150 |
:return: An instance of Certificate class representing the generated intermediate CA cert |
144 | 151 |
""" |
145 | 152 |
|
... | ... | |
194 | 201 |
:param extensions: Extensions to be used when generating the certificate |
195 | 202 |
:param usages: A dictionary containing usages of the certificate to be generated (see constants.py) |
196 | 203 |
:param days: Number of days for which the generated cert. will be considered valid |
204 |
:raises InvalidCertificateAttribute: when a subject with an invalid attribute is passed |
|
197 | 205 |
:return: An instance of Certificate class representing the generated cert |
198 | 206 |
""" |
199 | 207 |
|
Také k dispozici: Unified diff
Added docstrings describing the reasons why an InvalidCertificateAttribute error might be raised in the CertificateService.