As I understand, any software working with X.509 certificates may have own basis to decide, whether a certificate is trusted or not.
AFAIK OpenSSL just consults a l
I recently looked into this, and found no way to get OpenSSL to list the certificates in its trusted set. The best way I found was to, as you point out, "consult that file [/etc/ssl/certs] myself (on my particular installation of OpenSSL)".
You can be more installation-independent about finding the directory which OpenSSL consults. openssl version -d prints the path to it.
% openssl version -d
OPENSSLDIR: "/opt/local/etc/openssl"
OpenSSL looks here for a file named cert.pem and a subdirectory certs/. Certificates it finds there are treated as trusted by openssl s_client and openssl verify (source: the article, What certificate authorities does OpenSSL recognize?).
So, you can do something like:
% find -H `openssl version -d | sed -E 's/OPENSSLDIR: "([^"]*)"/\1/'`/(cert.pem|certs) \
-type f -exec cat {} \+
This prints out the entire contents of the files which OpenSSL expects to contain certificates. If you want less than the entire file, then replace cat with the appropriate commands.