CentOS サーバー構築マニュアル

home > CentOS5 > OpenSSL 秘密鍵と証明書

OpenSSL 秘密鍵と証明書




■秘密鍵作成
[root@ns1 ~]# cd /etc/pki/tls/certs/
[root@ns1 certs]# make server.key
umask 77 ; \
        /usr/bin/openssl genrsa -des3 1024 > server.key
Generating RSA private key, 1024 bit long modulus
...................++++++
...............................................................++++++
e is 65537 (0x10001)
Enter pass phrase: ←パスフレーズを入力
Verifying - Enter pass phrase: ←再度パスフレーズを入力

■パスフレーズ削除
[root@ns1 certs]# openssl rsa -in server.key -out server.key
Enter pass phrase for server.key: ←先ほどのパスフレーズを入力
writing RSA key

■公開鍵作成
[root@ns1 certs]# make server.csr
umask 77 ; \
        /usr/bin/openssl req  -new -key server.key -out server.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) [GB]:JP ←国名
State or Province Name (full name) [Berkshire]:Tokyo ←都道府県名
Locality Name (eg, city) [Newbury]:Shibuya ←市区町村名
Organization Name (eg, company) [My Company Ltd]:centos.orz ←ホスト名(または会社名)
Organizational Unit Name (eg, section) []: ←空エンター
Common Name (eg, your name or your server's hostname) []:centos.orz ←ホスト名(または管理者名)
Email Address []:hostmaster@centos.orz ←管理者メールアドレス

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ←空エンター
An optional company name []: ←空エンター
※黄色い部分は環境に合わせて変更してください。

■証明書作成
[root@ns1 certs]# openssl x509 -in server.csr -out server.pem -req -signkey server.key -days 365
Signature ok
subject=/C=JP/ST=Tokyo/L=Shibuya/O=centos.orz/CN=centos.orz/emailAddress=hostmas                                                                                       ter@centos.orz
Getting Private key
[root@ns1 certs]# chmod 400 server.*
[root@ns1 certs]# cd



Home PageTop Forum Last updated 2008-05-12

Copyright centos.server-manual.com このサイトはリンクフリーです。ご自由にリンクしてください。