Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions pyhanko_certvalidator/fetchers/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,6 @@
)


ACCEPTABLE_PKCS7_PEM_ALIASES = frozenset(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

[
'application/x-pem-file',
'text/plain',
'application/pkcs7-mime',
'application/x-pkcs7-certificates',
'binary/octet-stream',
]
)


def unpack_cert_content(
response_data: bytes,
content_type: Optional[str],
Expand All @@ -99,14 +88,7 @@ def unpack_cert_content(
yield x509.Certificate.load(response_data)
elif (content_type in ACCEPTABLE_PKCS7_DER_ALIASES) and not is_pem:
yield from _unpack_der_pkcs7(response_data, url)
elif (
permit_pem
and is_pem
and (
content_type in ACCEPTABLE_CERT_PEM_ALIASES
or content_type in ACCEPTABLE_PKCS7_PEM_ALIASES
)
):
elif permit_pem and is_pem:
# technically, PEM is not allowed here, but of course some people don't
# bother following the rules
for type_name, _, data in pem.unarmor(response_data, multiple=True):
Expand Down