Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Douglas Wyatt

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Common keytool commands needed for living with Java

   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
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS