使用OpenSSL检查SSL证书的步骤如下:
openssl s_client -connect example.com:443 -servername example.com
将example.com
替换为你想要检查的网站域名。
quit
并按回车键退出OpenSSL会话。如果你想查看完整的证书链(包括中间证书),可以使用以下命令:
openssl s_client -connect example.com:443 -showcerts -servername example.com
这将显示从服务器到根证书的完整证书链。
你可以使用以下命令来验证证书是否有效:
openssl verify -CAfile /path/to/ca-bundle.crt example.com.crt
将/path/to/ca-bundle.crt
替换为你的CA证书包路径,example.com.crt
替换为你要验证的证书文件路径。
通过以上方法,你可以轻松地使用OpenSSL检查SSL证书的有效性和详细信息。