Hi everyone,
I am working with digital signatures with iText 5.3.2 (c#), but have an
issue with the PdfReader.
First, I read the file with the following code:
string path = "some path to my pdf file...";
PdfReader pdf = new PdfReader(path);
Then, I created a copy of the reader:
PdfReader pdfCopy = new PdfReader(pdf); //I need to keep the original
PdfReader for a background process, reading again the file takes 20 secs
per each.
After that, I tried to sign the pdfCopy:
FileStream fout = new FileStream("...some directory\output.pdf",
FileMode.Create)
PdfStamper stp = PdfStamper.CreateSignature(pdfCopy.Reader, fout, '\0',
null, true);
PdfSignatureAppearance sap = stp.SignatureAppearance;
IExternalSignature es = new PrivateKeySignature(pk, "SHA-256");
MakeSignature.SignDetached(sap, es, chain, null, null, null, 0,
CryptoStandard.CADES);
And Adobe Reader cannot read the file, with error 14.
If I sign the original PdfReader "pdf", everything goes perfect, but
signing the "pdfCopy" somehow corrupts the file. Please, help me with the
following questions:
- Can I sign more than once the same PdfReader? I mean, can I keep the same
PdfReader in memory and sign it again, simulating reading the pdf on each
signature attemp.
- Is the pdfCopy different form the original? Why I cannot sign it?
Thanks in advance for your help and time.
Regards,
Jose
--
Saludos cordiales,
José Bonilla
(+593) 95031497
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php