Howto sign a pdf with a x509 certificate from certificate store

I want to add a digital signature to a existing pdf document.


I’m able to sign a pdf with a local available pfx file accordingto Add digital signature or digitally sign PDF in C#|Aspose.PDF for .NET

I now want to sign an existing pdf document with a certificate which is part of the local certificate store(on windows).

Is it possible to sign a pdf using a given X509Certificate2(which can be loaded from the cert store)?
It seems it works with aspose.words: Digitally Sign PDF in Word to PDF Conersion in C# | .NET Word API
But for aspose.pdf, i did not find a way to use a X509Certificate2 for signing the document


Hi Manuel,


Thanks for your inquiry. I am afraid currently Aspose.Pdf for .NET does not support creation of signature objects (PKCS1, PKCS7, etc) with passing X509Certificate2. It applies as input parameter pfx files only. We have logged a feature request PDFNEWNET-37412 for same in our issue tracking system. We will update you as soon as it is implemented.

However as a work around. you may try to convert X509Certificate2 object into pfx object using following code snippet. Hopefully it will serve the purpose.

Please feel free to contact us for any further assistance.


Best Regards,