Certificates 101

To view the details of a certificate:

openssl x509 -in <certificate.cer> -text

To view the details of cacerts file:

keytool -list -keystore <cacerts>

To view the details of a specific certificate included in a cacerts file:

keytool -list -v -keystore <cacerts> -alias "<alias>"

To export, in a der format, a certificate from a cacerts file:

keytool -export -keystore <cacerts> -alias "<alias>" -file <certificate.der>

To convert a certificate from a der format into a pem format:

 openssl x509 -inform der -in <certificate.der> -out <certificate.cer>

To generate a concatenate certificate chain:

cat certificate.cer intermediate.cer root.cer >combiner.cer