Thursday, August 06, 2015

SSL using Keytool and integrating it with Tomcat

use this command to create keystore in specific folder

C:\Certitificate>keytool -genkey -alias siddhu -keyalg RSA -keystore C:\Certitificate\siddhukeystore
fill all the necessary information it is asked

Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: siddharatha dhumale
What is the name of your organizational unit?
[Unknown]: test
What is the name of your organization?
[Unknown]: test
What is the name of your City or Locality?
[Unknown]: pune
What is the name of your State or Province?
[Unknown]: maharashtra
What is the two-letter country code for this unit?
[Unknown]: IN
Is CN=siddharatha dhumale, OU=test, O=test, L=pune, ST=maharashtra, C=IN correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
Re-enter new password:
After this you will be able to see a file with name siddhukeystore inside C:\Certitificate folder
Verify the content using 
keytool -list -keystore C:\Certitificate\siddhukeystore
Change server.xml of Tomcat placed inside conf folder 
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="C:\Certitificate\siddhukeystore"
keystorePass="password" />

and restart server and finally check the url using https protocal.

Note: As this certificate is self authenticated it will ask the end user to add exception and allow them to move forward. 

No comments: