Thomas
Thomas

Reputation: 1039

Analyze SSL certificate programmatically or via commandline

I'ld like to analyze the certificate of a given url and get some details of it. Do you know any ways to do this? A command-line tool can be something like downloadSSLCert https://my.funny.url/ > certFile and then analyzing it for e.g. the fingerprint of the cert. It can be a command line utility, a C/C++/Objective-C or Java code and will be used on osx >= 10.5

Upvotes: 3

Views: 1947

Answers (1)

Alnitak
Alnitak

Reputation: 339955

You can make an SSL connection from the command line thus:

echo '' | openssl s_client -connect www.google.com:443

The output will contain the X.509 cert in base64 encoding.

To view further details,

... | openssl x509 -fingerprint -text

If you only want the fingerprint, omit the "-text" flag and add "-out /dev/null".

Upvotes: 8

Related Questions