ベリサインが今年中にすべてのSSLのルート証明書を2048bit対応にバージョンアップします。
それに対応して、csrも2048bitで生成する方法をお知らせします。一般のcsrも同様の方法で生成できます。1.まずopensslの場所を調べます。
#which openssl
/usr/bin/openssl2.カレントディレクトリを移動します。
#cd /usr/bin
3.秘密鍵作成のための擬似乱数の情報を生成します【無くてもできます】。
./openssl md5 * > rand.dat
4.作成した擬似乱数ファイル(rand.dat)から、秘密鍵を作成します。
トリプルDESを使い、2048bit の秘密鍵(ファイル名:key2010.pem)を作成する場合の例。2048bitであることが、ルート証明書の関係で重要です。# ./openssl genrsa -rand rand.dat -des3 2048 > key2010.pem
57625 semi-random bytes loaded
Generating RSA private key, 2048 bit long modulus
……………………….+++
……………………………………………+++
e is 65537 (0×10001)
Enter pass phrase:5.パスフレーズを求められますので、2回入力します。パスフレーズは忘れないように。後で必要になります。
Enter pass phrase:適当なパスワード
Verifying – Enter pass phrase:確認用の適当なパスワード6.指定した名前でファイルができていることを確かめます。
#ls-la
-rw-r–r– 1 root root 1751 6月 23 13:52 key2010.pem7.次に、csrファイルを生成します。
openssl req -new -key key2010.pem -out csr2010.pem
8.先ほどのパスフレーズを求められます。
Enter pass phrase for key2010.pem:9.この後は、国、都道府県、市、組織名、コモンネームと順番に入力します。
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) [GB]:JP
State or Province Name (full name) [Berkshire]:Aichi
Locality Name (eg, city) [Newbury]:Nagoya-city
Organization Name (eg, company) [My Company Ltd]:Sixpence Inc.
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server’s hostname) []:www.6web.ne.jp10.ここから下は入力しないでください。エンターキーで次に行けます。
Email Address []:
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:11.ここまでで完了です。
指定した名前で、2048bitのcsrファイルができています。
セキュリティ上好ましくないが、パスフレーズ無しにしたいときの方法も併記します。
——
■パスフレーズなしで鍵を生成する場合
通常の作成方法
# openssl genrsa -des3 -out ./ssl.key/xxxxxxx.key 2048
*”-des3”はdes3アルゴリズムのパスワード保護するという意味です。
パスワードなしの作成方法
# openssl genrsa -out ./ssl.key/xxxxxxx.key 2048
■パスフレーズを後から解除する場合
元ファイルのバックアップ
# cp xxxxxxx.key xxxxxxx.key.org
パスワードの解除
# openssl rsa -in xxxxxxx.key -out xxxxxxx.key
