Digitally sign PDF documents produced by Aspose.Words

I like this job of announcing new features. We have been doing it in this blog “informally” either just before the next release or just after it. Today I felt like it is time to “acknowledge” this as an activity that we will do on a regular basis.
It’s only been a week since Aspose.Words for .NET 9.4 and already our next version shceduled for some time in October is shaping up. The features that were in the works are being integrated into the trunk and I get to spend some time reviewing them.
So far I posted about the new feature that allows to split HTML and EPUB into parts. I was particularly impressed with how much difference it made to viewing generated EPUB books on my iPod.
Yesterday I got to review another new feauture that allows you to add a digital signature to PDF documents generated by Aspose.Words. I found it very easy to use and just had to post about it. Here is how you do it:

// Load a document in any format supported by Aspose.Words.
Document doc = new Document(@"C:\MyDocument.docx");
// Create the save options that will cause the digital signature to be attached.
PdfSaveOptions options = new PdfSaveOptions();
// Optional. I justed wanted to check that the document still complies to PDF/A-1b
options.Compliance = PdfCompliance.PdfA1b;

// You need to load your certificate or get it from the storage.
X509Certificate2 cert = new X509Certificate2(@"C:\MyCertitifcate.pfx", "my cert password");
// Set this object in the options.
options.DigitalSignatureDetails = new PdfDigitalSignatureDetails(cert, // Your certificate.
"Меня попросили!", // optional, reason for signing. I type in Russian to check Unicode strings go okay.
"Москва Товарная", // optional, location of signing.
new DateTime(2010, 9, 12)); // time of signing.

doc.Save(@"C:\MyDocument Out.pdf", options);

Here is how the output document looks like.

Here is some more techical details.
In this version Aspose.Words creates a PKCS#7 signature over the whole PDF document and uses the “Adobe.PPKMS” filter and “adbe.pkcs7.sha1” subfilter when creating a digital signature. The signature has no visual appearance on the page.
Let us know if you are interested in other signature types or their visual appearances.

Hi,

We need such functionality. But there are two issues for us:

  1. We need the visual appearance for the signature on the pdf, and we have to set the position of it ourself

  2. We use hardware token, with them you can never directly access the private key. And at the moment it seems this is not working with your lib.

cheers

manuel

Hi Manuel,

Thank you for your interest in Aspose.Words. I logged your feature requests into our defect database. We will let you know once these features are available.

Best regards,

Alexey.