GoogleSearchBox

Custom Search

Tuesday, June 18, 2013

Using Java keytool On Windows, Configuring SSL (https) on tomcat 6

Below are my exact commands from the command prompt (command line) in windows Xp (with installed softwares as: JDK 1.6.0_24 and  Tomcat 5.5.36) :


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\psshibaram>keytool -genkey -alias tomcat -keypass changeit -keyalg RSA
Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  localhost
What is the name of your organizational unit?
  [Unknown]:  DMS
What is the name of your organization?
  [Unknown]:  MyCompanyName
What is the name of your City or Locality?
  [Unknown]:  Bangalore
What is the name of your State or Province?
  [Unknown]:  Karnatak
What is the two-letter country code for this unit?
  [Unknown]:  IN
Is CN=192.162.5.69, OU=DMS, O=MyCompanyName, L=Bangalore, ST=Karnatak, C=IN correct?
  [no]:  yes


C:\Documents and Settings\psshibaram>keytool -export -alias tomcat -keypass changeit -file server.cr
t
Enter keystore password:
Certificate stored in file <server.crt>

C:\Documents and Settings\psshibaram>dir
 Volume in drive C has no label.
 Volume Serial Number is 74A0-5FBF

 Directory of C:\Documents and Settings\psshibaram

06/10/2013  05:01 PM    <DIR>          .
06/10/2013  05:01 PM    <DIR>          ..
05/16/2013  04:50 PM    <DIR>          .eclipse
06/10/2013  05:00 PM             1,355 .keystore
05/16/2013  04:31 PM    <DIR>          .m2
05/15/2013  04:44 PM    <DIR>          .myeclipse
06/03/2013  04:37 PM                36 .org.eclipse.epp.usagedata.recording.userId
05/15/2013  04:26 PM                25 .pulse2.locator
06/07/2013  05:22 PM    <DIR>          Desktop
05/15/2013  03:09 PM    <DIR>          Favorites
06/07/2013  06:32 PM    <DIR>          My Documents
06/10/2013  03:25 PM               600 PUTTY.RND
06/10/2013  05:01 PM               587 server.crt
04/18/2013  08:59 PM    <DIR>          Start Menu
               5 File(s)          2,603 bytes
               9 Dir(s)   8,078,270,464 bytes free

C:\Documents and Settings\psshibaram>keytool -import -file server.crt -keypass changeit -keystore C:
\Java\jdk1.6.0_24\jre\lib\security\cacerts
Enter keystore password:
Owner: CN=localhost, OU=DMS, O=MyCompanyName, L=Bangalore, ST=Karnatak, C=IN
Issuer: CN=localhost, OU=DMS, O=MyCompanyName, L=Bangalore, ST=Karnatak, C=IN
Serial number: 51b5b8f2
Valid from: Mon Jun 10 17:00:58 GMT+05:30 2013 until: Sun Sep 08 17:00:58 GMT+05:30 2013
Certificate fingerprints:
         MD5:  31:B6:06:9F:77:58:33:3B:B8:AD:79:9B:44:77:A9:B0
         SHA1: 6E:EE:E0:C7:19:5F:EE:AB:6F:E0:BD:60:DB:56:FA:7F:9A:82:DC:08
         Signature algorithm name: SHA1withRSA
         Version: 3
Trust this certificate? [no]:  yes
Certificate was added to keystore

C:\Documents and Settings\psshibaram>


Where "psshibaram" is my Windows Xp System username.
And C:\Java\jdk1.6.0_24\   is where my JDK installed,   that is my JAVA_HOME is set to "C:\Java\jdk1.6.0_24\"  
And I have my PATH variable set to PATH=%PATH%;JAVA_HOME\bin;
So please change/set your JAVA_HOME and PATH properly (if you are not able to use the "keytool" command)




No comments:

Post a Comment