the command below uses openssl to obtain the public certificate of example.com
openssl x509 -in <(openssl s_client -connect example.com:443 -prexit 2>/dev/null) -out example.crt
the command below uses openssl to obtain the public certificate of example.com
openssl x509 -in <(openssl s_client -connect example.com:443 -prexit 2>/dev/null) -out example.crt