AIA returning PEM-encoded PKCS7 #196
Replies: 1 comment 1 reply
-
Sure thing! From what I remember, this would be legal if the PKCS#7 payload were not PEM-encoded (and the content type were correct...). As such, most of the handling code should already be in place. If that is indeed the case, all that needs to happen is (a) add I've put some implementation notes below, but if/when you make your PR, please branch off the 0.19.6 release tag instead of [Reason: The Currently, there's this piece of logic in the response handler: elif permit_pem and (content_type in ACCEPTABLE_CERT_PEM_ALIASES):
# technically, PEM is not allowed here, but of course some people don't
# bother following the rules
if pem.detect(response_data):
for _, _, data in pem.unarmor(response_data, multiple=True):
yield x509.Certificate.load(data) The Other than that, I'd factor out the common extraction logic from the |
Beta Was this translation helpful? Give feedback.
-
Dear @MatthiasValvekens,
There is a CA that is using a rogue endpoint for Authority Information Access. The URL returns an
application/octet-stream
content type with a PEM-encoded PKCS7 file with the certificate chain. Neitherapplication/octet-stream
nor PEM-encoded PKCS7 can be handled bypyhanko_certvalidator
'sfetchers/common_utils.py
.The first step for a PR is to add
application/octet-stream
toACCEPTABLE_CERT_PEM_ALIASES
, however the second is not clear to me. We require the functionality ofelif permit pem and (content type in ACCEPTABLE CERT PEM ALIASES):
, which accepts PEM, as well aselif content type == 'application/pkcs7-mime':
, which reads CMS.Would you be willing to embrace a PR that addresses the aforementioned issues? If so, could you please tell me how you want me to organize the solution?
You can see this in action with the attached files files.zip and
python3 -m pyhanko --verbose sign validate --pretty-print signed.pdf --trust ac-raiz-v3.cer --trust tsa_cert.pem
.Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions