Search code examples
keytoolself-signedjar-signingjarsigner

Jar signing -validity property


I used the -validity property of the keytool to generate a keystore and self sign a jar. During the process, I saw the debug message that says

 [info] Warning:
 [info] This jar contains entries whose signer certificate will expire within six
 months.

I am using the following commands,

keytool -genkey -alias signFiles -keypass mypass  -keystore mystore -storepass mypass-alias store -validity 365
keytool -selfcert -keystore mystore -alias store

Am I doing something wrong here? Actually I wanted to sign the jar with a certificate for 1 year.

Cheers, J


Solution

  • Add -validity 365 to your -selfcert command.