Hi Team,
I’ve a few queries related to digital signature using Aspose Words for Java 14.5.
- Aspose doesn’t allow to pick a certificate from the keystore. The certificate has to be present as file. Is there a way to pick the certificate from the keystore.
- Does the certificate has to be in PKCS format? I tried with JKS keystore type and it didn’t work.
- Is it mandatory that the certificate contain private key? Could a single .pfx file contain more than one private key?
- What is the signature algorithm used? Will the algorithm same for PDF and Word document?
- Is there a way to sign the word document during save?
- Are DOC, DOCX, DOCM formats supported?
Thanks,
Kumar
// Sample code for PDF
PdfSaveOptions options = new PdfSaveOptions();
options.setDigitalSignatureDetails(new PdfDigitalSignatureDetails("c:\temp\keystore.pfx", "private_key_password", "Test digital signature", "Here", new Date()));
doc.save("C:\test_signature.pdf", options);
// Sample code for Word
X509Certificate2 cert = new X509Certificate2("c:\temp\keystore.pfx", "private_key_password");
doc.save("C:\test_old.doc");
DigitalSignatureUtil.sign("C:\test_old.doc", "C:\test_signature.doc", cert, "Test digital signature", new Date());