コンフィグレーションガイド Vol.2


9.4.2 サーバ証明書と鍵の作成

サーバ証明書と鍵の作成に当たって,opensslに入力する情報を次の表に示します。

表9‒7 opensslに入力する情報

名称

内容・意味

pass phrase for server.key

サーバ用パスワード

Country Name

国コード

State or Province Name

都道府県名

Locality Name

市町村名

Organization Name

団体名または会社名

Organizational Unit Name

部署名

Common Name

FQDNまたは本装置のIPアドレス

Email Address

管理者の電子メールアドレス

challenge password

optional company name

(凡例)−:入力不要

SSL用サーバ証明書と鍵は,opensslが動作する環境で作成します。次に手順を示します。また,実行例では次に示すファイル名を使用します。

なお,openssl動作環境のプロンプトを「unix#」とします。

〈この項の構成〉

(1) 乱数シードファイルを準備する

数百バイト程度のファイル(rand.dat)を準備します。内容およびコードは問いません。

(2) SSL通信で使用する鍵を作成する

鍵長を2048ビットとした鍵(server.key)を作成する例を次の図に示します。

図9‒36 鍵の作成
unix# openssl genrsa -out server.key -aes256 -rand rand.dat 2048
241 semi-random bytes loaded
Generating RSA private key, 2048 bit long modulus
..................................................................+++
.............+++
e is 65537 (0x10001)
Enter pass phrase for server.key: *******                             …1
Verifying - Enter pass phrase for server.key: *******                 …2
  1. サーバ用のパスワードを入力します。

  2. サーバ用のパスワードを再入力します。

(3) 署名要求書を作成する

SHA256を使用して,秘密鍵(server.key)から署名要求書(server.pem)を作成する例を次の図に示します。なお,この図で入力する情報は,操作を示すために使用したものです。実際には,CA局が発行するCA証明書,および中間CA証明書との照合に必要な情報を入力してください。

図9‒37 署名要求書の作成
unix# openssl req -new -sha256 -key server.key -out server.pem
Enter pass phrase for server.key: *******                             …1
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) [AU]:JP                                  …2
State or Province Name (full name) [Some-State]:KANAGAWA              …3
 
Locality Name (eg, city) []:KAWASAKI                                  …4
Organization Name (eg, company) [Internet Widgits Pty Ltd]:AlaxalA    …5
Organizational Unit Name (eg, section) []:AX                          …6
 
Common Name (e.g. server FQDN or YOUR name) []:www.example.com        …7
Email Address []:admin@example.com                                    …8
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:                                              …9
An optional company name []:                                          …9
  1. サーバ用のパスワードを入力します。

  2. 国コードを入力します。

  3. 都道府県名を入力します。

  4. 地域を入力します。

  5. 会社名を入力します。

  6. 任意の名称を入力します。

  7. FQDNまたは本装置のIPアドレスを入力します。

  8. メールアドレスを入力します。

  9. 何も入力しません。

(4) サーバ証明書を作成する

-daysオプションを使用して,有効期限を365日と設定したサーバ証明書(server.crt)を作成する例を次の図に示します。

図9‒38 サーバ証明書の作成
unix# openssl x509 -in server.pem -out server.crt -req -signkey server.key -days 365
Signature ok
subject=/C=JP/ST=KANAGAWA/L=KAWASAKI/O=AlaxalA/OU=AX/CN=www.example.com/emailAddress=admin@example.com
Getting Private key
Enter pass phrase for server.key: *******                             …1
  1. サーバ用のパスワードを入力します。

(5) 装置にインストールするための秘密鍵を生成する

装置にインストールするための秘密鍵(serverinstall.key)を生成する例を次の図に示します。

図9‒39 秘密鍵の生成
unix# openssl rsa -in server.key -out serverinstall.key
Enter pass phrase for server.key: *******                             …1
writing RSA key
  1. サーバ用のパスワードを入力します。