Skip to content

PKCS7 beeing treated as a certificate in unpack_cert_content #350

Closed Answered by MatthiasValvekens
MatLaft asked this question in Q&A
Discussion options

You must be logged in to vote

Argh, if only CAs would actually bother to follow what the dang specification requires... 😠

I think your trial-and-error approach is the only viable one generally speaking, if the server doesn't respect the Content-Type requirements, the only way to tell whether something is a certificate or a PKCS#7 payload is to decode it...

That said, I would do the check slightly differently: maybe it's slightly safer to do a core.Sequence.load(...) and use the length of the resulting sequence value to discriminate (for a certificate it will be 3, for a PKCS#7 payload it'll be 2). The reason why I think this is better is because cert.native will attempt to parse the full Certificate structure complete…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MatthiasValvekens
Comment options

Answer selected by MatLaft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants