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.
1. Download GroupDocs.Signature for .NET or install it using NuGet.
2. Add the following namespaces in your code.
3. Load digitally signed PDF document using an instance of Signature class.
4. Instantiate the DigitalVerifyOptions object and specify verification options.
5. Call Verify method of Signature class’ instance and pass DigitalVerifyOptions to it.
6. Check verification results from VerificationResult object.
Complete code
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.