Adding Certificate files to Java KeyStore

Introduction SSL

Most of those sites use the Socket Layer (SSL) protocol to secure their Internet applications.

SSL allows the data from a client, such as a Web browser, to be encrypted prior to transmission so that someone trying to sniff the data is unable to decipher it.

Many Java application servers and Web servers support the use of keystores for SSL configuration.

If you’re building secure Java programs, learning to build a keystore is the first step.

Source :
http://www.javacodegeeks.com/2014/07/java-keystore-tutorial.html#introduction

 

What is Java Key Tool ?

Java Keytool is a key and certificate management utility. It allows users to manage their own public/private key pairs and certificates.
Java Keytool stores the keys and certificates in what is called a keystore. It protects private keys with a password.

Each certificate in a Java keystore is associated with a unique alias.
When creating a Java keystore you will first create the .jks file that will initially only contain the private key,
then generate a CSR. Then you will import the certificate to the keystore including any root certificates.

Source:
http://www.javacodegeeks.com/2014/07/java-keystore-tutorial.html#keytool

 

Steps to manually import certficicates into KeyStore

 

1. Create a KeyStore in machine

keytool -keystore <KeyStoreName> -genkey -alias <Key Store Alias>
eg:
keytool -keystore mykeystore -genkey -alias myalias

 

refer:
https://docs.oracle.com/javase/tutorial/security/toolsign/step3.html

 

2. Get the Certificate File and keep it in a location

eg: Certificate file name is scarlet.cer

 

3. Import the Certificate as a Trusted Certificate to keystore

keytool -import -alias <AliasName> -keystore <KeyStoreName> -file <FilePath>
eg:
keytool -import -alias susan -keystore mykeystore -file scarlet.cer

 

Advertisements
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: