Skip to content

Commit

Permalink
Include full PEM in certificate structure
Browse files Browse the repository at this point in the history
  • Loading branch information
boppreh committed Jan 18, 2024
1 parent 6dd7b40 commit 08f5e49
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hello_tls/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class Certificate:
days_until_expiration: int
signature_algorithm: str
extensions: dict[str, str]
pem: str

def get_server_certificate_chain(connection_settings: ConnectionSettings, client_hello: ClientHello) -> Iterable[Certificate]:
"""
Expand Down Expand Up @@ -255,6 +256,7 @@ def _x509_time_to_datetime(x509_time: Optional[bytes]) -> datetime:
days_until_expiration = (not_after - connection_settings.date).days

yield Certificate(
pem=crypto.dump_certificate(crypto.FILETYPE_PEM, raw_cert).decode('utf-8'),
serial_number=str(raw_cert.get_serial_number()),
subject=_x509_name_to_dict(raw_cert.get_subject()),
issuer=_x509_name_to_dict(raw_cert.get_issuer()),
Expand Down

0 comments on commit 08f5e49

Please sign in to comment.