4
votes

I've been using iTextSharp to sign PDFs in my application, and it works pretty good using this code I adapted from the java example on the iText website:

PdfStamper stp = PdfStamper.CreateSignature(reader, outmemstream, ControlChars.NullChar);
PdfSignatureAppearance sap = stp.SignatureAppearance;
sap.SetCrypto(prvKey, new X509Certificate[] {sigCert, Repository.CAcertificate}, null, pdfSignatureAppearance.SELF_SIGNED);
sap.Reason = "Just to proove I can sign!";

This has worked ok until version 5.2.1 of iText, but in the recent version 5.3.0 the "SetCrypto" method has been removed and I cannot sign anymore! Any ideas on why it has been removed and what may be an alternative method to sign a pdf on the new version??

Thanks in advance

2

2 Answers

1
votes

PDF signing has been refactored in iText 5.3.0 and a white paper is currently being written about the new signing process. The final version should be published in September.

You'll find more information here.

1
votes

the book examples are already adapted to iText 5.3.0: http://itextpdf.com/book/chapter.php?id=12