Search code examples
pythonpdfdigital-signaturesignaturepython-pdfreader

PDF document: How to verify the digital signature using python?


We are doing the RPA project and extract the data PDF to excel using python. Now we need verify the digital_signature in PDF.


Solution

  • According to PDF 1.7 spec a document may contain:

    • one or more approval signatures
    • at most one certification signature
    • at most two usage rights signatures

    There are also 2 defined digest computing techniques. So there is no short answer and checking digital signatures might be tricky.

    See PDF 1.7 section 12.8 Digital Signatures

    As far as I know there is no ready-to-run python library to check all possible PDF signatures. You may try to use pdfreader to browse PDF document structure and to compute and check the signatures. See few examples