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?
// 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()));
// Sample code for Word
X509Certificate2 cert = new X509Certificate2(“c:\temp\keystore.pfx”, “private_key_password”);
DigitalSignatureUtil.sign(“C:\test_old.doc”, “C:\test_signature.doc”, cert, “Test digital signature”, new Date());