SSL証明書大丈夫?(SHA2証明書かどうかの確認)



●確認

 参考URL:証明書がSHA-2証明書になっているかの確認方法(opensslコマンドの場合)

 たまたま上記のページを見つけたので早速オレオレ証明書(自己証明書)を確認してみました。試験したサーバはCentOS 7です。
 opensslコマンドを使用して確認します。
 「s_client 実行後、標準入力からの入力待ちになるので、それを回避する為に nul(Windows) や /dev/null(Linux) を入力して終了させています。」とのことです。
Windows
openssl s_client -connect サーバ:ポート番号 > cert.txt < nul
Linux
openssl s_client -connect サーバ:ポート番号 > /tmp/cert.txt < /dev/null


# openssl s_client -connect localhost:443 > /tmp/cert.txt < /dev/null
depth=0 C = JP, ST = Tokyo, O = BIGBANG, CN = www.bigbang.mydns.jp, emailAddress = webmaster@mail.bigbang.mydns.jp
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 C = JP, ST = Tokyo, O = BIGBANG, CN = www.bigbang.mydns.jp, emailAddress = webmaster@mail.bigbang.mydns.jp
verify error:num=21:unable to verify the first certificate
verify return:1
DONE

# openssl x509 -text -noout -in /tmp/cert.txt
Certificate:
Data:
Version: 3 (0x2)
Serial Number: ******************* (*******************)
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=JP, ST=Tokyo, O=BIGBANG, CN=www.bigbang.mydns.jp/emailAddress=webmaster@mail.bigbang.mydns.jp
Validity
Not Before: Mar 4 04:31:12 2016 GMT
Not After : Mar 2 04:31:12 2026 GMT
Subject: C=JP, ST=Tokyo, O=BIGBANG, CN=www.bigbang.mydns.jp/emailAddress=webmaster@mail.bigbang.mydns.jp
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**
X509v3 Authority Key Identifier:
keyid:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**

Signature Algorithm: sha256WithRSAEncryption
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:
**:**:**:**:



 出力結果に「Signature Algorithm: sha256WithRSAEncryption」があれば、SHA2証明書だそうです。
 てか、SHA2証明書になるように作成していたのでした。