Subbu created TIKA-4999:
---------------------------

             Summary: 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


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)

Reply via email to