views:

491

answers:

1

Hey there,

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

Thanks in advance! Thomas

+6  A: 

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".

Alnitak
+1 I'd like more: openssl s_client -connect www.google.com:443 | less cuz the output may be extensive
victor hugo
Thanks! And is there a way to get the fingerprints out of this infos? Google for example has a sha1 fingerprint starting with AB:BE. How to get the fingerprints?
Thomas
@Victor - the OP appears to want a non-interactive method - less is an interactive cmd.
Alnitak
@Thomas - use -fingerprint
Alnitak
@Alnitak: Thanks, with the option -sha1, I can read the informations, I need!
Thomas