简体   繁体   中英

Signing a PDF with iTextSharp

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

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 .

该书示例已经适应iText 5.3.0: http ://itextpdf.com/book/chapter.php? id=12

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM