Search code examples
javapdfopenssl

Extract information of digital certificate from doc/pdf


I have two files. one is doc and another is pdf. Now, what I want to do:

  1. try to extract the information of digital certificate(if exists) from the doc/pdf.
  2. Verify the information.

I tried to get the information of digital certificate from doc/pdf using OPENSSL, CERTUTIL, JAVA, PHP, iTEXT, TCPDF etc etc. There are tons of way to sign a file or get information from cert/pem etc. but how to get the file which contains the information of that specific word/pdf file.

Now, I even do not know, where the digital certificate stored in the MS word and PDF. Has anyone any idea on this ?

Thank you for taking your time. ANY OPINION will be a big help for this newbie.


Solution

  • Both DOC/DOCX formats and PDF formats define digital signatures in format specifications. You can't use OpenSSL or other similar general-purpose stuff for verifying signatures of documents in these formats. Maybe iText can validate the PDF signature, but I have yet to see a library to handle DOCs.

    The SecureBlackbox component suite (namely its OfficeBlackbox and PDFBlackbox packages), which we maintain, can do exactly what you need - validate digital signatures, extract and validate certificates used to sign documents in Office (MS Office, OpenOffice/LibreOffice) and PDF documents.