This is a work in progress.
----------------------------------------------------------------------
Using OpenSSL - most common activities
----------------------------------------------------------------------
Generally used for X509 artifacts, i.e. the more open standard.
Dump X509 certificate(CRT) content - assumes PEM format
openssl x509 -in certificate.crt -text -noout
Dump X509 certificate(CRT) content - specify input format, PEM/DER
openssl x509 -inform DER -in site.crt
NB:Try changing the format on error: "Expecting: TRUSTED CERTIFICATE"
Dump a pkcs12 user identity certificate
openssl pkcs12 -info -in keyStore.p12
Dump private key content
openssl rsa -in host.key -text
----------------------------------------------------------------------
Using OpenSSL - creating and modifying keys
----------------------------------------------------------------------
Create a private key
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
----------------------------------------------------------------------
Using keytool - most common activities
----------------------------------------------------------------------
Generally used for working with Java keystore(JKS) files.
List contents of a JKS
keytool -list -v -keystore keystore.jks
Dump a cert
keytool -printcert -v -file host.crt
Export a cert from a JKS for given alias
keytool -export -alias sitename -file sitename.crt -keystore keystore.jks
List default JVM CA certs
keytool -list -v -keystore $jAVA_HOME/jre/lib/security/cacerts
----------------------------------------------------------------------
Debugging an SSL Connection
----------------------------------------------------------------------
You are trying to set up a Java webserver fronting SSL and having issues.
Test the connection using openSSL to see what SSL it supports
openssl s_client -connect mysite.com:443
Enable SSL debug
Add the following to the JVM startup command:
-Djavax.net.debug=[ssl|all]
and see this to understand the output.
This will often lead you to the cause of the connection issues.
----------------------------------------------------------------------
Resources
----------------------------------------------------------------------