Thursday, July 12, 2012

Self-Integrity Check FAILED: java.lang.SecurityException: The jar file is not signed

I digged in this a lot .
This problem came when I exported executable Jar from eclipse I tried to connection a third party software which uses encryption for getting and sending messages .
If you bundle dependent jars in that executable jar JDK thinks that you have manipulated those jars and throws this security exception .
For creating executable Jar if you are using many thrid party jars always export those jars in folder with that jar otherwise be ready for exception  "Self-Integrity Check FAILED: java.lang.SecurityException: The jar file is not signed".
Many software write their own code for  jar integrity check (ie JAR provider details  ie manifest .mf file etc )to avoid malware and tampering of Jars .

In case of web applicartion this might come in case of JBOSS 5.1(if you migrate from 4.XX) for this case you have to move encryption jars to EAR level and set class path to those.

You can write you own code to verify integrity of jar .
for more details visit
How to Implement a Provider for the JavaTM Cryptography Extension