[
https://issues.apache.org/jira/browse/TIKA-4999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18132172#comment-18132172
]
ASF GitHub Bot commented on TIKA-4999:
--------------------------------------
subbudvk opened a new pull request, #3420:
URL: https://github.com/apache/tika/pull/3420
A certificates-only PKCS#7 file (a .p7b bundle with no signers and no
content) is currently detected by content as application/pkcs7-signature. This
is because the application/pkcs7-signature magic matches only the outer
wrapper, a DER ContentInfo with the signedData OID. Certs-only bundles and real
signatures share that wrapper.
> Certs-only PKCS#7 (.p7b) detected as application/pkcs7-signature instead of
> application/x-pkcs7-certificates
> -------------------------------------------------------------------------------------------------------------
>
> Key: TIKA-4999
> URL: https://issues.apache.org/jira/browse/TIKA-4999
> Project: Tika
> Issue Type: Bug
> Components: tika-core
> Reporter: Subbu
> Priority: Major
>
> Issue:
> A certificates-only PKCS#7 file (a .p7b bundle with no signers and no
> content) is detected by content as _application/pkcs7-signature._
> Cause:
> The application/pkcs7-signature magic matches only the outer wrapper, a DER
> ContentInfo with the signedData OID. Certs-only bundles and real signatures
> share that wrapper
> Fix:
> Add a magic rule to application/x-pkcs7-certificates at priority 60, above
> the signature rule's 50. It matches the signedData wrapper, then requires an
> empty digestAlgorithms set (31 00). A real signature has at least one digest
> algorithm, so it doesn't match.
> A test in Pkcs7DetectionTest uses existing content.
> testPKCS7_certs_only_def.p7c is detected as x-pkcs7-certificates by content.
>
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)