I am working with Jarsigner. I want to check whether the given jar is signed or not. If user uploads a jar file, I want to find whether the jarfile is signed or not. I tried with the below code, (http://docs.oracle.com/javase/6/docs/technotes/guides/security/crypto/HowToImplAProvider.html#integritycheck)
// Ensure the jar file is signed.
Manifest man = jarFile.getManifest();
if (man == null) {
throw new SecurityException("The provider is not signed");
}
But even if I provide a jar which is not signed, man
object is not null and this exception is not thrown. How can I check whether the given jar is just signed or not ?