Wrong signing time after signing a Word Document

I used below code to sign a Word document. But the signing time of the signed document is 8 hours later.

    import java.io.File;
    import java.io.FileInputStream;
    import java.util.Date;

    import com.aspose.pdf.License;
    import com.aspose.words.CertificateHolder;
    import com.aspose.words.DigitalSignature;
    import com.aspose.words.DigitalSignatureUtil;
    import com.aspose.words.Document;

    public class AsposeWordTest {

    	public static void main(String[] args) {
    		String basePath = <directory where all files are stored>;
    		String licenseFile = basePath + File.separator + "Aspose.Total.Java.lic";
    		String pfxFile = basePath + File.separator + "test.pfx";
    		String pfxPassword = "password";
    		String srcWord = basePath + File.separator + "sample2.doc";
    		String signWord = basePath + File.separator + "sign.doc";
    		try {
    			// Sign
    			CertificateHolder certHolder = CertificateHolder.create(pfxFile, pfxPassword);
    			DigitalSignatureUtil.sign(srcWord, signWord, certHolder);
    			System.out.println("Time when sign is called = " + new Date());
    			// Read cert
    			Document doc = new Document(signWord);
    			for (DigitalSignature signature : doc.getDigitalSignatures())
    			    System.out.println("Time obtained from digital signature: " + signature.getSignTime());
    		} catch (Exception e) {

    	private static void loadLicenseFile(String licenseFile) throws Exception {
    		// Load aspose license
    		try (FileInputStream is = new FileInputStream(licenseFile)){
    			License license = new License();
    		} catch (Exception e) {
    			throw e;

Time when sign is called = Tue Jun 15 14:07:11 CST 2021
Time obtained from digital signature: Tue Jun 15 22:07:10 CST 2021

files.zip (25.3 KB)


We have logged this problem in our issue tracking system as WORDSJAVA-2605. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-2605) have been fixed in this Aspose.Words for Java 21.10 update.