I have a certificate bundle .crt file.
doing openssl x509 -in bundle.crt -text -noout
only shows the root certificate.
how do i see all the other certificates?
I have a certificate bundle .crt file.
doing openssl x509 -in bundle.crt -text -noout
only shows the root certificate.
how do i see all the other certificates?
http://comments.gmane.org/gmane.comp.encryption.openssl.user/43587 suggests this one-liner:
It indeed worked for me, but I don't understand the details so can't say if there are any caveats.
for openssl 1.1.1 and higher: a single-command answer can be found here serverfault.com/a/1079893 (
openssl storeutl -noout -text -certs bundle.crt
)Java's
keytool
does the trick:Annotation: Windows doubleclick does not work. Windows reads only the first certificate in the keystore and automatically extends the trustchain from its built in certificate store.
Results:
.crt
file are not shown.crt
file. This may lead to wrong conclusions.Oneliner that displays a summary of every certificate in the file.
It combines all the certificates into a single intermediate PKCS7 file, and then parses the information in each part of that file.
(The same as Beni's answer, but this gives shorter output, without the
-text
option).example:
Following this FAQ led me to this perl script, which very strongly suggests to me that
openssl
has no native support for handling the nth certificate in a bundle, and that instead we must use some tool to slice-and-dice the input before feeding each certificate toopenssl
. This perl script, freely adapted from Nick Burch's script linked above, seems to do the job:Paraphrasing from the OpenSSL documentation:
The
openssl storeutl
app was added in OpenSSL 1.1.1.The
storeutl
command can be used to display the contents fetched from the given URIs.-noout
prevents output of the PEM data-text
prints out the objects in text form, like the-text
output fromopenssl x509
-certs
Only select the certificates from the given URISince there is no awk based solution:
The first command split bundle into certs by looking for BEGIN, and END lines. The second command loops through the extracted certs and shows them.
This may not be pretty, or elegant, but it was quick and worked for me using bash on linux, and PEM formatted blocks in a ca-cert bundle file.
You can put it all one line, and adjust the openssl options to suit. I really wish there were a more elegant solution for this, but in this case I think finding the more elegant solution would have taken more time than hacking out the inelegant one.
Try this script: https://github.com/jkolezyn/cert_tree
It prints certificates in a pem bundle as a tree, built based on Subject and Issuer fields.
It prints a tree like this:
In bash usually only one (long) line of code is needed :-)
I'd like to throw in the idiomatic perl commandline here:
If there's text then a slightly more robust tweak:
Just change the value of what n should be in the second statement to get the nth certificate.