This short guide explains how to verify digital signature in Word document using Java. It has the programming instructions set, the IDE settings, and a sample code for digital certificate verification in Word using Java. Various properties exposed by the API are used to demonstrate all the necessary properties for the signature verification in a Word file.
Steps for DOCX Signature Validation using Java
- Set the IDE to use Aspose.Words for Java to detect and verify digital signatures
- Define the source Word file and check the presence of the digital signatures in it
- Load the signatures from the target Word file and display its count
- Parse through all the signatures in the file and display their properties
- For each signature, access the CertificateHolder object and display its properties
The following steps summarize how to perform Word document signature authentication using Java. First, detect the presence of digital signatures by accessing the FileFormatInfo of the source Word file and then load the collection of signatures from it. Parse through all the properties in each signature, display its properties, fetch the CertificateHolder object from each signature and further display its properties for verifying all the necessary parameters in the Word file.
Code to Verify Electronic Signature in DOCX using Java
This code demonstrates the development of a Word digital signature checker using Java. There are many other properties available that can further be used to describe the digital signatures such as you can access the signature format or type using the sig.getSignatureType() method, get raw signature bytes using sig.getSignatureValue(), display user friendly information with one API call sig.toString(), and even perform document level verification using the signatures.isValid() method. More certificate level information is also available, like valid from date, valid to date, and the signature algorithm used for signing the document.
This article has taught us the process to verify and fetch properties of digital signatures in a Word file. To print Word files with comments, refer to the article Print Word Document with Comments using Java.