The errors are compile time error, not runtime errors.
WINCER_SIGNED cannot be resolved or is not a field.
and the other error is as follows:
setVisibleSignature
The method setVisibleSignature(Rectangle, int, String) in the type PdfSignatureAppearance is not applicable for the arguments (Rectangle, int, null)
Regards.
P.S.
I am just trying to sign the pdf, nothing complicated actually. Just for learning purposes.
An update: I also tried for the example source code in stackoverflow but the problem is that it uses the old version and when I go for itextpdf package, the above problems emerge again. So, there is no backward compatibility in this.
Now, my error is no longer compile time but runtime as follows:
java.io.IOException: DerInputStream.getLength(): lengthTag=109, too big.
at sun.security.util.DerInputStream.getLength(Unknown Source)
at sun.security.util.DerValue.init(Unknown Source)
at sun.security.util.DerValue.<init>(Unknown Source)
at sun.security.pkcs12.PKCS12KeyStore.engineLoad(Unknown Source)
at java.security.KeyStore.load(Unknown Source)
and line 34 which is ks.load(...) line.
What to do? Any missing section? Should i do something extra?
I think you are right. i changed the keystore instance to JKS and the exception changes as follows:
Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jcajce/provider/digest/MD2$Digest
ExternalDigest digest = new BouncyCastleDigest();
As referenced library, i have itext-5.3.3.jar
Now, what should I do to fix this classdeffounderror?
Regards.
P.S. I have as:
import com.itextpdf.text.pdf.security.BouncyCastleDigest;
What is the error ? Please post also the error.
Here are some examples to look at
http://stackoverflow.com/questions/9666266/how-to-digitally-sign-a-pdf-using-itext
http://itextpdf.com/examples/iia.php?id=222
http://www.vogella.com/articles/JavaPDF/article.html
http://itextpdf.sourceforge.net/howtosign.html
http://www.berthou.com/us/2009/07/01/verify-pdf-signature-with-itext/
Regards,
Tomas Helgi