Hi Experts

 

Though there are scores of questions answered on this, i (very possible
it's a mistake i am making) am unable to find a solution to this!.

 

I am stuck with a problem

I signed a pdf document using following code..

 

            String pfxSource = "abcd.pfx";

            String RESOURCE = $fileName;

            String RESULT = $fileName_res;

            

            KeyStore ks = KeyStore.getInstance("PKCS12");

 

            ks.load(new FileInputStream(pfxSource), <pfx
password>.toCharArray());

            String alias = (String)ks.aliases().nextElement();

            PrivateKey key = (PrivateKey)ks.getKey(alias, <pfx
password>.toCharArray());

 

            Certificate[] chain = ks.getCertificateChain(alias);

 

            PdfReader reader = new PdfReader(RESOURCE);

            FileOutputStream os = new FileOutputStream(RESULT);

 

            PdfStamper stamper = PdfStamper.createSignature(reader, os,
'\0');

 

            stamper.setEncryption(true, null, null
,PdfWriter.ALLOW_PRINTING);                       ----- A

            PdfSignatureAppearance appearance =
stamper.getSignatureAppearance();

 

            appearance.setCrypto(key, chain,
null,PdfSignatureAppearance.SELF_SIGNED);

 

            Rectangle rectangle = new Rectangle(310, 50, 510, 100);

            appearance.setVisibleSignature(rectangle, 1, null);

            stamper.close();

 

This way i applied a digital signature to the file and locked all its
properties..only allowing printing (please refer to mark A)

I accidentally deleted the source file and now have to create it back
from this result file...but am unable to do so. I am unable to open the
file using a PdfReader..It says 

"PdfReader not opened with owner password"

 

Or is there any other way to remove the digital signature, or to strip
content from a signed file?

 

What can possibly be the owner password. (Sorry, of course the problem i
am facing is due to my lack of knowledge...)

I really have gone through almost whole mail archive before asking it
here. Please help..thanks a lot!!

 

Thanks & Regards

Shwetank

5908

 


======================================
i-choose online store at www.tataindicom.com
Your Comfort.Your Convenience.YourChoice.
====================================== 

DISCLAIMER:
The information contained in this message (including any attachments) is 
confidential and may be privileged. If you have received it by mistake please 
notify the sender by return e-mail and permanently delete this message and any 
attachments from your system. Any dissemination, use, review, distribution, 
printing or copying of this message in whole or in part is strictly prohibited. 
Please note that e-mails are susceptible to change.TATATELESERVICES LTD. 
(including its group companies) shall not be liable for the improper or 
incomplete transmission of the information contained in this communication nor 
for any delay in its receipt or damage to your system. TATA TELESERVICES LTD. 
(or its group companies) does not guarantee that the integrity of this 
communication has been maintained nor that this communication is free of 
viruses, interceptions or interference.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to