Digital Signatures in documents look similar to the paper-based signatures, however, being certificate-based electronic signatures they contain the identity of the signer in encrypted form. The certificates are issued by trusted and authorized Certificate Authorities. These authorities identify the person the certificates are issued to. This is why the digitally signed documents can be verified at any time. In this article, I’ll show you how to programmatically verify the digital signature in PDF, Word, and Excel, documents by using GroupDocs.Signature for .NET API with C#.
Steps to verify digitally signed PDF document
For demonstration, I am using a PDF document for digital signature verification. However, the same code will work for MS Word and Excel document formats.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3. Load digitally signed PDF document using an instance of Signature class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4. Instantiate the DigitalVerifyOptions object and specify verification options.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5. Call Verify method of Signature class’ instance and pass DigitalVerifyOptions to it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thus, you can determine whether the digital signature in the PDF document meets the specified criteria or not. Finally, you can mark the document as valid or invalid. Read more about GroupDocs.Signature for .NET API here.