I had a signed Jar zip containing the following content:
- META-INF, a directory containing MANIFEST.MF, SERVER.RSA, and SERVER.SF
- image.bin
After that I created a tampered Jar file by adding a few characters to image.bin. I tested it with
jarsigner -verify jar.zip
which gave error the error
jarsigner: java.lang.SecurityException: SHA1 digest error for image.bin
which was expected.
Now I need to verify this Jar zip programmingly in Java, and there was an example here. Basically it just opened a Jar file, iterated through the entries and checked for SecuirtyException. However, it didn't give any SecurityException. I am wondering what I may miss here.