jsvine / pdfplumber

Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables.
MIT License
6.27k stars 641 forks source link

Extract digital signatures from pdf #756

Open FaizanCW opened 1 year ago

FaizanCW commented 1 year ago

Extract signature from signed PDF and get all information related to that signature and validate signature is authenticated or not, authentication means signature is attached in PDF is generally generated by or based on a certificate or key so when we need to check that signature is generated by a specific key or certificate then we will able to do that.

Please refer this stackoverflow solution for this functionality in which they have used pdfreader library for that: https://stackoverflow.com/questions/72556172/how-to-locate-digital-signatures-in-pdf-files-with-python

jsvine commented 1 year ago

Hi @FaizanCW, thanks for the suggestion. Do you have an example you could attach of a PDF with a digital signature that you'd like to verify?

Note to my future self and/or anyone who would like to implement this feature: The relevant section of the PDF reference is 8.7 Digital Signatures.

FaizanCW commented 1 year ago

pdf_digital_signature_timestamp.pdf

sample01.pdf

Here you find the sample pdfs with digital signature in it...Thanks @jsvine

FaizanCW commented 1 year ago

Please refer this library also for the reference...This library have much more functionality for digital signature validation and fetching all types of information of signature and certificate...! https://www.example-code.com/chilkat2-python/pdf_signatures.asp