We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Digitally signing a pdf

Hi,

I am also trying to sign a pdf digitally - is there any example source for this please? All the source that is in the pdf kit download seems to make use of deprecated methods.

Kind regards,

Roy

Hi Roy,

We have improved the signing mechanism and you may use the following code for digitally signing a PDF file:



PdfFileSignature pdfSign = new PdfFileSignature(“aspose.pdf”, “asposesigned.pdf”);

Pkcs1Signature signature = new Pkcs1Signature(“certificate.pfx”, “12345”);

//Pkcs7Signature signature = new Pkcs7Signature(“certificate.pfx”, “12345”);

pdfSign.sign(1, “Name”, “Reason”, “Contact”, “Location”, new Rectangle(100,400,200,500),


signature );

pdfSign.save();

Also, please confirm from the certificate issuing authority that what kind of certificate it is (PKCS1, PKCS7 or PKCS7 detached and then use the signature class accordingly.

I hope this helps. If you find any further questions, please do let us know.
Regards,
shahzad.latif:
Hi Roy,

We have improved the signing mechanism and you may use the following code for digitally signing a PDF file:

PdfFileSignature pdfSign = new PdfFileSignature("aspose.pdf", "asposesigned.pdf");
Pkcs1Signature signature = new Pkcs1Signature("certificate.pfx", "12345");
//Pkcs7Signature signature = new Pkcs7Signature("certificate.pfx", "12345");
pdfSign.sign(1, "Name", "Reason", "Contact", "Location", new Rectangle(100,400,200,500),

signature );
pdfSign.save();


Do any of your PdfFileSignature constructors use Streams for the input/output files? For the classes I've used, all of your other Pdf.Kit classes use Streams.

Hi Jay,

You may use bindPdf and save methods of PdfFileSignature class to pass streams as input and output.

I hope this helps. If you find any further questions, please do let us know.
Regards,