SSL証明書の関連ファイルの中身確認系コマンド

SSL証明書の関連ファイルの中身どんな内容なんだっけとか思う時があるのでそれらを見る時のコマンドメモ。

ファイル名対応表
CSRファイル xxxxx.csr
秘密鍵ファイル xxxxx.key
SSL証明書ファイル xxxxx.crt


CSRファイル情報確認

openssl req -noout -text -in xxxxx.csr


秘密鍵ファイル情報確認

openssl rsa -noout -text -in xxxxx.key


SSL証明書ファイル情報確認

openssl asn1parse -in xxxxx.crt

もしくは

openssl x509 -text -noout -in xxxxx.crt


SSL証明書ファイル有効期限確認

openssl x509 -noout -text -in xxxxx.crt

または

openssl s_client -connect example.com:443 | openssl x509 -noout -enddate