2016年12月4日 星期日

How to add certificate for SSL


I just joined a Hackthon recently, here is the node how I solve some problems.


1. check the certificate from a Web

$keytool -printcert -sslserver 10.2.5.2

2. get the certificate chain

$keytool -printcert -sslserver 10.2.5.2 -rfc

3. copy the message between header and footer in .crt file (ex. vm1.crt)

-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-------

4. add the certificate in client's truststore

$keytool -import -file vm1.crt -alias vm1 -keystore xxx.truststore

($ input the password of keystore)

5. check the list of certificate you just added into truststore

$keytool -list -v -keystore xxx.truststore






REFER
http://doc.akka.io/docs/akka/2.4.4/scala/http/client-side/https-support.html

http://typesafehub.github.io/ssl-config/WSQuickStart.html#connecting-to-a-remote-server-over-https

https://docs.oracle.com/cd/E19509-01/820-3503/6nf1il6er/index.html

http://www.ibm.com/developerworks/library/j-customssl/sidebar.html

http://how2ssl.com/articles/working_with_pem_files/


http://stackoverflow.com/questions/8640340/how-do-i-get-into-a-non-password-protected-java-keystore-or-change-the-password