Revize 9dbbcdae
Přidáno uživatelem Stanislav Král před asi 4 roky(ů)
proj/services/cryptography.py | ||
---|---|---|
141 | 141 |
:param csr: a string containing the CSR to be signed |
142 | 142 |
:param issuer_pem: string containing the certificate of the issuer that will sign this CSR in PEM format |
143 | 143 |
:param issuer_key: string containing the private key of the issuer's certificate in PEM format |
144 |
:param issuer_key_pass: string containing the private key of the issuer's certificate in PEM format |
|
144 |
:param issuer_key_pass: string containing the passphrase of the private key of the issuer's certificate in PEM |
|
145 |
format |
|
145 | 146 |
:param config: TODO NOT USED |
146 | 147 |
:param extensions: extensions to be applied when signing the CSR |
147 | 148 |
:return: string containing the generated and signed certificate in PEM format |
... | ... | |
166 | 167 |
|
167 | 168 |
return self._run_for_output(params, proc_input=(bytes(proc_input, encoding="utf-8"))).decode() |
168 | 169 |
|
170 |
def create_crt(self, subject, key, issuer_pem, issuer_key, key_pass=None, issuer_key_pass=None, config="", |
|
171 |
extensions=""): |
|
172 |
""" |
|
173 |
Signs the given CSR by the given issuer CA |
|
174 |
:param subject: subject to be added to the created certificate |
|
175 |
:param key: string containing the private key to be used when creating the certificate in PEM format |
|
176 |
:param issuer_key: string containing the private key of the issuer's certificate in PEM format |
|
177 |
:param issuer_pem: string containing the certificate of the issuer that will sign this CSR in PEM format |
|
178 |
:param issuer_key: string containing the private key of the issuer's certificate in PEM format |
|
179 |
:param key_pass: string containing the passphrase of the private key used when creating the certificate in PEM |
|
180 |
format |
|
181 |
:param issuer_key_pass: string containing the passphrase of the private key of the issuer's certificate in PEM |
|
182 |
format |
|
183 |
:param config: TODO NOT USED |
|
184 |
:param extensions: extensions to be applied when creating the certificate |
|
185 |
:return: string containing the generated in PEM format |
|
186 |
""" |
|
187 |
csr = self.make_csr(subject, key, subject_key_pass=key_pass) |
|
188 |
return self.sign_csr(csr, issuer_pem, issuer_key, issuer_key_pass=issuer_key_pass, extensions=extensions) |
|
189 |
|
|
169 | 190 |
|
170 | 191 |
class CryptographyException(Exception): |
171 | 192 |
|
Také k dispozici: Unified diff
Re #8472 - Added create_crt method that creates a certificate
Added 3 unit tests testing the added method.