[
https://issues.apache.org/jira/browse/TIKA-4454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18005073#comment-18005073
]
Salvatore MORANA edited comment on TIKA-4454 at 7/14/25 9:14 AM:
-----------------------------------------------------------------
Hi Tim, thanks for your reply.
To detect the correct MIME type for ".p7m" (application/pkcs7-mime) or ".p7s"
(application/pkcs7-signature) files,
you need to parse the contents of the pkcs7 envelope:
- pkcs7-mime: wraps the message and may include encryption or a signature with
contents.
- pkcs7-signature: contains just the signature data, meant to verify a
separate file (detached signature).
Using OpenSSL :
openssl pkcs7 -in <filename> -inform DER -print -text
We can see the content differences between a p7m file and a P7S file,
I attach the logs files (testDetached.p7s.txt and test.pdf.p7m.txt) of the
openssl commands, indicated above, for the files test.pdf.p7 and
testDetached.p7s and a screen shot ( file PKCS7-Content.jpg) that highlights an
important difference in the case of .p7m
What do you think of our proposal?
Thanks a lot for your time
Kindly Regards
was (Author: JIRAUSER310281):
Hi Tim, thanks for your reply.
To detect the correct MIME type for ".p7m" (application/pkcs7-mime) or ".p7s"
(application/pkcs7-signature) files,
you need to parse the contents of the pkcs7 envelope:
- pkcs7-mime: wraps the message and may include encryption or a signature with
contents.
- pkcs7-signature: contains just the signature data, meant to verify a
separate file (detached signature).
Using OpenSSL :
openssl pkcs7 -in <filename> -inform DER -print -text
We can see the content differences between a p7m file and a P7S file,
I attach the logs files (testDetached.p7s.txt and test.pdf.p7m.txt) of the
openssl commands, indicated above, for the files test.pdf.p7 and
testDetached.p7s and a screen shot ( PKCS7-Content.jpg) that highlights an
important difference in the case of .p7m
What do you think of our proposal?
Thanks a lot for your time
Kindly Regards
> Media-type application/pkcs7-mime
> ----------------------------------
>
> Key: TIKA-4454
> URL: https://issues.apache.org/jira/browse/TIKA-4454
> Project: Tika
> Issue Type: Bug
> Affects Versions: 3.2.1
> Reporter: Salvatore MORANA
> Priority: Major
> Attachments: PKCS7-Content.jpg, test.pdf.p7m, test.pdf.p7m.txt,
> testDetached.p7s, testDetached.p7s.txt
>
>
> Using the tika release 3.2.1, the detect method recognized EvelopedData (
> extension file .p7m) with Media-Type "application/pkcs7-mime" as
> "application/pkcs7-signature". This is a bug.
> Log with standalone release:
> Content-Length: 18211
> Content-Type: application/pkcs7-signature
> X-TIKA:Parsed-By: org.apache.tika.parser.DefaultParser
> X-TIKA:Parsed-By: org.apache.tika.parser.crypto.Pkcs7Parser
> X-TIKA:Parsed-By-Full-Set: org.apache.tika.parser.DefaultParser
> X-TIKA:Parsed-By-Full-Set: org.apache.tika.parser.crypto.Pkcs7Parser
> X-TIKA:Parsed-By-Full-Set: org.apache.tika.parser.pdf.PDFParser
> X-TIKA:digest:MD5: 8e011e26c464702a3ae91da49410a624
> X-TIKA:digest:SHA256:
> b8755cfd1a444c2da4b583edfb4d2edbebe7d0e802e4c8ced19a70283f5a9424
> resourceName: ExampleDoc.pdf.p7m
> As writted in the rfc RFC 5751
> ( https://www.rfc-editor.org/rfc/rfc8551.html , chapters "3.2. "The
> application/pkcs7-mime Media Type" and "3.2.1. The name and filename
> Parameters")
> the correct mediaType for EvelopedData is application/pkcs7-mime.
>
> I attach the file used for the tests.
> Thanks
--
This message was sent by Atlassian Jira
(v8.20.10#820010)