Revize 5c748d51
Přidáno uživatelem Stanislav Král před asi 4 roky(ů)
src/services/cryptography.py | ||
---|---|---|
231 | 231 |
# the process failed because of some other reason (incorrect cert format) |
232 | 232 |
raise CryptographyException(OPENSSL_EXECUTABLE, args, err.decode()) |
233 | 233 |
|
234 |
def extract_public_key(self, cert_pem: str) -> str: |
|
235 |
""" |
|
236 |
Extracts a public key from the given certificate passed in PEM format |
|
237 |
:param cert_pem: PEM data representing a certificate from which a public key should be extracted |
|
238 |
:return: a string containing the extracted public key in PEM format |
|
239 |
""" |
|
240 |
args = ["x509", "-in", "-", "-noout", "-pubkey"] |
|
241 |
return self.__run_for_output(args, proc_input=bytes(cert_pem, encoding="utf-8")).decode() |
|
242 |
|
|
234 | 243 |
def parse_cert_pem(self, cert_pem): |
235 | 244 |
""" |
236 | 245 |
Parses the given certificate in PEM format and returns the subject of the certificate and it's NOT_BEFORE |
Také k dispozici: Unified diff
Re #8573 - Implemented extract_public_key method that allows the caller to extract a public key from a certificate