Skip to content

Instantly share code, notes, and snippets.

@houtianze
Last active March 22, 2017 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save houtianze/9aba8661bebac5ea810f3d67c543dfa7 to your computer and use it in GitHub Desktop.
Save houtianze/9aba8661bebac5ea810f3d67c543dfa7 to your computer and use it in GitHub Desktop.
Get Cert in X509
function get_cert()
{
	local host="$1"
	local port="$2"
	if [ -z "$port" ]
	then
		port="443"
	fi

	openssl s_client -showcerts -connect $host:$port </dev/null 2>/dev/null | openssl x509
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment