For school, I need to sign a jar and was provided with the following tutorial https://docs.oracle.com/javase/tutorial/security/toolsign/.
So, I start with making and compiling a simple Program that prints "Hello World!" and put it in a jar with the following command:
jar cvfm Hello.jar Hello.class MANIFEST.M
After that I generate my keys with the following command, it doesn't matter that it's self signed.
keytool -genkey -alias indy -keystore indystore
After generating my keys I sign my jar with the following command
jarsigner -tsa http://sha256timestamp.ws.symantec.com/sha256/timestamp -keystore indystore -signedjar SignedHello.jar Hello.jar indy
Now when I want to verify my signed jar I get multiple errors and I don't know why. I'm using adoptopenjdk 11 if that matters.
jarsigner -verify -keystore indystore SignedHello.jar
Errors I get:
- This jar contains entries whose certificate chain is invalid.
Reason: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- This jar contains entries whose signer certificate is self-signed.
The verbose output with warnings looks like this: