Free Support Forum - aspose.com

Examples for Signing using a KeyStore?

Hi,


I’m using Aspose with a demo licence with the view to purchase asap. I’m attempting to sign a document and have this working using the following;

// pdfDocument holds the PDF file as a byte[]
System.IO.MemoryStream inputStream = new System.IO.MemoryStream(pdfDocument);
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(inputStream);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(1, 1, 1, 1);
PKCS1 signature = new PKCS1(@“MyPFX.pfx”, “toto”);
pdfSign.Sign(1, “Signature Reason”, “Contact”, “Location”, false, rect, signature);
System.IO.MemoryStream outputStream = new System.IO.MemoryStream();
pdfSign.Save(outputStream);

This is all working as it should. If I add the pfx to the local key store and then create the PKCS1 from a stream to sign the document I get an error!

Is there any online documentation and/or examples for going this?

Many thanks
Mat

Hi Mat,

We’re looking into your requirement at our end and you’ll be updated with the results shortly.

Regards,

Hi,


Is there any update on this as it is critical for a project I am working on. If not we’ll have to start looking at other vendors.

Hi Mat,

I’m sorry to inform you that Aspose.Pdf for .NET only allows you to sign the PDF using the signature from the PFX file. It doesn’t allow you to sign the PDF from the KeyStore at the moment. However, I have logged a new feature request as PDFNEWNET-29354 in our issue tracking system. You’ll be updated via this forum thread once it is supported in future.

We’re sorry for the inconvenience.
Regards,

The issues you have found earlier (filed as PDFNET-29354) have been fixed in Aspose.PDF for .NET 19.3.