Just tried and works perfect now!
Thanks.
Regards,
Jose.
El martes, 28 de agosto de 2012, Paulo Soares escribió:
> It's fixed, you can get the code from the SVN.
>
> Paulo
>
> On Tue, Aug 28, 2012 at 8:34 PM, José Santiago Bonilla Pazmiño
> <[email protected]> wrote:
> > Thank you so much for your feedback.
> >
> > Hope to hear news about the solution tomorrow, and if it is not going to
> be
> > fixed in C# yet, please, let me know so that I can change my downloaded
> > source code meanwhile.
> >
> > Regards,
> >
> > Jose.
> >
> > El martes, 28 de agosto de 2012, Paulo Soares escribió:
> >
> >> It's a bug both in Java and C#. It only happens with PDFs with
> >> compressed object streams. It will be fixed tomorrow.
> >>
> >> Paulo
> >>
> >> On Tue, Aug 28, 2012 at 5:16 PM, José Santiago Bonilla Pazmiño
> >> <[email protected]> wrote:
> >> > Sure, attached an example from the external tool that generates the
> >> > PDFs.
> >> >
> >> > When signing the original "reader" everything is OK, but when signing
> >> > the
> >> > duplicate "readerCopy", Adobe Reader X shows error:
> >> > "There was a problem reading this document (14)"
> >> >
> >> > I tried with some PDF files from the same source, and the same
> >> > behaviour.
> >> >
> >> > And, this is the code, with iTextSharp 5.3.2:
> >> >
> >> > String CERT_PATH = "../signingCert.p12";
> >> > String CERT_PASSW = "Password";
> >> >
> >> > string IN_FILE = "manual_desobediencia.pdf";
> >> > string OUT_FILE = "manual_desobediencia_signed.pdf";
> >> >
> >> > FileStream fs = new FileStream(CERT_PATH, FileMode.Open);
> >> > Pkcs12Store ks = new Pkcs12Store(fs, CERT_PASSW.ToCharArray());
> >> > string alias = null;
> >> > foreach (string al in ks.Aliases)
> >> > {
> >> > if (ks.IsKeyEntry(al) && ks.GetKey(al).Key.IsPrivate)
> >> > {
> >> > alias = al;
> >> > break;
> >> > }
> >> > }
> >> > fs.Close();
> >> > ICipherParameters pk = ks.GetKey(alias).Key;
> >> > X509CertificateEntry[] x = ks.GetCertificateChain(alias);
> >> > X509Certificate[] chain = new X509Certificate[x.Length];
> >> > for (int k = 0; k < x.Length; ++k)
> >> > {
> >> > chain[k] = x[k].Certificate;
> >> > }
> >> >
> >> > PdfReader reader = new PdfReader(IN_FILE);
> >> > PdfReader readerCopy = new PdfReader(reader);
> >> >
> >> > FileStream fout = new FileStream(OUT_FILE, FileMode.Create);
> >> > PdfStamper stp = PdfStamper.CreateSignature(readerCopy, fout, '\0',
> >> > null,
> >> > true);
> >> > PdfSignatureAppearance sap = stp.SignatureAppearance;
> >> > sap.SetVisibleSignature(new iTextSharp.text.Rectangle(100, 100, 300,
> >> > 200),
> >> > 1, "Signature");
> >> >
> >> > IExternalSignature es = new PrivateKeySignature(pk, "SHA-256");
> >> >
> >> > MakeSignature.SignDetached(sap, es, chain, null, null, null, 0,
> >> > CryptoStandard.CADES);
> >> >
> >> > El martes, 28 de agosto de 2012, Paulo Soares escribió:
> >> >
> >> >> Works for me in C#. Can you post the PDF you use?
> >> >>
> >> >> Paulo
> >> >>
> >> >> On Tue, Aug 28, 2012 at 2:52 PM, José Santiago Bonilla Pazmiño
> >> >> <[email protected]> wrote:
> >> >> > Thanks Michael,
> >> >> >
> >> >> > I think there is some diference between Java and C#. I tried this
> >> >> > code
> >> >> > without running anything else than the copy and the signature of
> that
> >> >> > copy,
> >> >> > and Error 14 in Adobe Reader again.
> >> >> >
> >> >> > I will keep trying, hope to find a solution.
> >> >> >
> >> >> > Regards,
> >> >> >
> >> >> > Jose.
> >> >> >
> >> >> > El martes, 28 de agosto de 2012, mkl escribió:
> >
> ------------------------------------------------------------------------------
> > 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] <javascript:;>
> > 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
>
>
> ------------------------------------------------------------------------------
> 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] <javascript:;>
> 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
>
--
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