I am trying to decrypt a pdf through itext. First i have signed it (the PDF), and then i have encrypted it with a certificate. This is working ok.
Now what I want is to decrypt it. For this reason, I am using the PdfReader object, I have seen that it is responsible to decrypt it, and now I want to create a new PDF decrypted from this PdfReader. I have tried it by many ways, and the new PDF is decrypted now, but the mistake is the thing that i wrote you before, I told you that the range of bytes of the sign is not valid. This is my code: ********** PdfReader reader = new PdfReader ( "prueba.pdf" miCertificado, miKey, miProvider); ********** Now I have the decrypted PDF in the reader var, so I am trying to create a new one from this var(reader). ************ FileOutputStream os = new FileOutputStream ( "nuevo.pdf"); PdfStamper stamper = new PdfStamper (reader, os); Stamper.close (); ************ Now I have my pdf (nuevo.pdf) decrypted but with an error in the signature. For this reason I need to create PDF file from a PdfReader. Is it possible to do this? Is there any other way to decrypt a pdf? Thanks. Bruno Lowagie (iText) wrote: > > senaguas wrote: >> HI everybody. >> >> i am trying to copy a pdf file that is signed, from an PdfReader object >> to this. >> > Why are you using PdfReader to do this? > Why not just copy the file with java.io classes? >> My problem is this: >> >> once the file is copied , i try to open it with acrobat (all versions), >> and acrobat says to me that the sign is wrong >> > Of course, this is expected behavior. We would have a SERIOUS PROBLEM > if the opposite were true given the fact that you are altering the > document with PdfCopy. > You could of course change a revision of the signed document using > PdfStamper, > but then you create an updated PDF. You can't just go and change a PDF > document > the way you do and expect the signature to be valid after the changes. > > Please do some more thinking with respect to your goal. > What do you want to do? Is what you are trying to do logical? > Then rephrase your question and post it again. > br, > Bruno > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services > for just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ > > -- View this message in context: http://www.nabble.com/COPY-PDF-FILE-WITH-PdfReader-tp14395589p14398025.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
