1
2 // generate a key -- make it long lived so we dont have to do this again
3 keytool -genkey -alias tomcat -keyalg RSA -validity 3650 -storepass changeit
4
5 // export cert to a file
6 keytool -export -rfc -v -file tomcatCert.crt -alias tomcat -storepass changeit
7
8 // look at the cert in the file
9 keytool -printcert -file tomcatCert.crt -storepass changeit
10
11
12 // delete pre-existing cert
13 keytool -delete -alias tomcat -keystore c:/apps/jdk/jre/lib/security/cacerts -storepass changeit
14
15 // import cert into a keystore
16 keytool -import -file tomcatCert.crt -trustcacerts -alias tomcat -keystore c:/apps/jdk/jre/lib/security/cacerts -storepass changeit
17
18 // look at the imported cert
19 keytool -list -alias tomcat -keystore c:/apps/jdk/jre/lib/security/cacerts -storepass changeit