Keytool selfcert. Specifying validity more than 365 days. How?


keytool, you can specify validity as 365 days. Could I do it for 2 or 3 years maybe? Is that doable using keytool? Any ideas ? Anyone???

keytool -selfcert -alias Test -genkey -keystore temp.keystore -keyalg RSA -validity 365

Can we do for 3 yrs like this below?

keytool -selfcert -alias Test -genkey -keystore temp.keystore -keyalg RSA -validity 1095

Thanks. If answer is no, what is a good option. Try to get certificate from a third party perhaps?

For a self issued certificate you should be able to validate it for as long as you choose.

I have not created self certificate but my co-worker did and put the expiration date to 10 years. No problem.

So I guess, your co worker did

keytool -selfcert -alias Test -genkey -keystore
 temp.keystore -keyalg RSA -validity 3650

Where 365 days in year * 10 = 3650 validity.

So this will work right? I am thinking of making the validity for 20 years. :slight_smile:

Sure, why not? Since it is a self signed certificate who cares?

Why not make it a hundred?