SHA-2(256)版SSLサーバ証明書の発行

2013年11月12日、MicrosoftがSHA-1ハッシュ関数を廃止すると言ったせいで、SSLサーバ証明書を発行するCA局から
SHA-2へ強制的に移行する方針が発表されており、Symantec(旧ベリサイン)、サイバートラストやグローバルサインはSHA-1の発行期限を2015年末としてます。
つまり、今年もしくは来年中にはSHA-2に移行する必要があります。

下記は、グローバルサインでSSLサーバ証明書をSHA-256に変更して更新した際の手順になります。

1. ハッシュ関数がSHA-2(256)で証明書発行要求(CSR)ファイルを作成
秘密鍵ファイルを再作成する必要はなく、既存の秘密鍵ファイルから証明書発行要求ファイルを作成すれば良いです。

# openssl req -new -sha256 -key /etc/pki/tls/private/www.example.com.key -out www.example.com-sha256.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:JP
State or Province Name (full name) []:Tokyo
Locality Name (eg, city) [Default City]:Chiyoda-ku
Organization Name (eg, company) [Default Company Ltd]:EXAMPLE CO.,LTD.
Organizational Unit Name (eg, section) []:www.example.com
Common Name (eg, your name or your server's hostname) []:www.example.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

2. 認証局からSSLサーバ証明書を発行
下記はグローバルサインで申し込んだ時です。
赤枠で囲った部分以外、SHA-1で申請した時と同じになります。

グローバルサインでSHA-2

グローバルサインでSHA-2

3. メールで認証局からSSLサーバ証明書が届く
グローバルサインだと、SSLサーバ証明書のところが”◆証明書 SHA256“となってました。

4. SSLサーバ証明書と中間CA証明書をインストール
以下はグローバルサインの場合で、中間CA証明書も再インストールする必要がありました。

# vi /etc/httpd/conf.d/ssl.conf
~~~上略~~~
# Point SSLCertificateFile at a PEM encoded certificate.  If
# the certificate is encrypted, then you will be prompted for a
# pass phrase.  Note that a kill -HUP will prompt again.  A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/www.example.co.jp.crt
メール本文にあった"◆証明書 SHA256"の内容をコピペしたファイルを指定します。

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/www.example.co.jp.key
既存の秘密鍵ファイルを指定したままにします

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convinience.
SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt
メール本文にあった"◆中間CA証明書"の内容をコピペしたファイルを指定します。
~~~下略~~~

5. httpdサービスの再起動

# /etc/rc.d/init.d/httpd restart

6. ブラウザでSSLを確認

証明書ビューア

証明書ビューア(SHA-256)

証明書ビューア(SHA-256)


SSLサーバ証明書
SSLサーバ証明書(SHA-256)

SSLサーバ証明書(SHA-256)


中間CA証明書
中間CA証明書(SHA-256)

中間CA証明書(SHA-256)


ルート証明書(以前と変わらず)
ルート証明書(以前と変わらず)

ルート証明書(以前と変わらず)

====================================================================
SHA-2に対応してないブラウザなんてないだろ・・・と思ってたらあった!
7年以上Windows Updateしてないサーバがあったよ!

IE6のSHA-2未対応

IE6のSHA-2未対応


暗号化 API を使用するアプリケーションが Windows Server 2003 では、X.509 証明書を検証できません。
http://support.microsoft.com/kb/938397/ja