如何在命令行上检查我的SSL证书是SHA1还是SHA2

问题描述:

如何从命令行检查我的SSL证书是使用SHA1还是SHA2?

How do I check if my SSL Certificate is using SHA1 or SHA2, from the commandline?

是的,我这类似于

And yes, i this is similar to this, but i need a cli-tool and i want to understand how it is done.

在搜索了一段时间后,我想到了以下代码段(unix):

after googling for quite some time i came up with the following snippet (unix):

openssl s_client -connect <host>:<port> < /dev/null 2>/dev/null | openssl x509 -text -in /dev/stdin | grep "Signature Algorithm"

windows(感谢Nick Westgate,请参见下文)

windows (thanx Nick Westgate, see below)

certutil -dump cacert.pem | find "Algorithm"