Friday, 14 February 2020

Install Certificates

Security:
Every JVM having 2 store hashmaps.
1) KeyStore Hash Map (cacerts)
2) TrustStore Hash Map

Every Server running on JVM, Server will also have a) Keystore HashMap b) TrustStore HashMap

Certificates are required to access secure sites using SSL protocol or making a secure connection from the client to the server.

1) JRE keystore named as "cacerts" in folder /jdk/jre/lib/security.

2) Common password of keystore is "Changeit".

3) Keytool is used to access keystore in Java and by using keytool you can list, add certificates from keystore.

Client KeyStore = Server TrustStore
Client TrustStore = Server KeyStore

Install Certificate Program:

Reference: https://github.com/escline/InstallCert

java InstallCert sgasci0023:443

It will generate cert file (keystore - jssecacerts) which folder are you calling


1) Convertion of generated certificate (jssecacerts) into .cer file

keytool -exportcert -alias sgasci0023-1 -keystore jssecacerts -storepass changeit -file sgasci0023.cer

2) Import that cert(.cer) into Map ( key : sgasci0023, value: sgasci0023.cer) - HashMap ( cacerts)
keytool -importcert -alias sgasci0023 -keystore C:\\Softwares\\openjdk8\\jre\\lib\\security\\cacerts -storepass changeit -file sgasci0023.cer


Convertion of pfx to jks file:
----------------------------------
//Fetching the alias name from pfx file
keytool -v -list -storetype pkcs12 -keystore \jks\TECHNICALACCOUNT.pfx -storepass password > c:\temp\keystore.txt

//alias name:le-054dff25-5ce3-4664-94e5-266d3df0c37f

//Now go to the folder of jks, then create it
keytool -importkeystore
-srckeystore ./TECHNICALACCOUNT.pfx
-srcstoretype pkcs12
-srcstorepass abcd
-srcalias le-054dff25-5ce3-4664-94e5-266d3df0c37f
-destkeystore ./TECHNICALACCOUNT.jks
-deststoretype jks
-deststorepass abcd
-destalias le-054dff25-5ce3-4664-94e5-266d3df0c37f

No comments:

Post a Comment