I am fetching a certificate chain with openssl s_client -showcerts -connect host.whatever:443 </dev/null
.
In addition to that I would like to extract the root certificate form the chain programmatically in the format -----BEGIN CERTIFICATE-----.....-----END CERTIFICATE-----
Does anybody know of a functionality that is capable of that and already ships with OpenSSL?