LoginSignup
16

More than 5 years have passed since last update.

SSLのkey/certificationが正しいPairか調べる(verifyする)

Posted at

Nginx にSSLを設定していて、以下のようなエラーにぶつかった。

SSL_CTX_use_PrivateKey_file(" ... /www.example.com.key") failed
   (SSL: error:0B080074:x509 certificate routines:
    X509_check_private_key:key values mismatch)

Private keyで、Certification(証明書)が読み込めない様子。
CertificationとKeyの一致をNginxの設定と切り離して検証するために、OpenSSLコマンドを使って検証する方法.

(ネットで検索しただけです)

a. まず、Keyを検証

$openssl rsa -in /key/path/name.key -modulus -noout | openssl md5
(stdin)= 値1

b. Certificationを検証

openssl x509 -in /crt/path/name.crt -modulus -noout | openssl md5
(stdin)= 値2

値1 と 値2 が一致していれば、オッケ一です。

参照
https://support.f5.com/kb/en-us/solutions/public/6000/700/sol6746.html

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16