2012年7月17日 星期二

[Linux] Produce ssl certificate

1.Produce private key
#openssl genrsa -out server.key 2048

2. 填寫憑證申請書
#openssl req -new -key server.key -out server.req

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]:TW
State or Province Name (full name) [Some-State]:Taiwan
Locality Name (eg, city) []:Taipei
Organization Name (eg, company) [Internet Widgits Pty Ltd]:R.B.K
Organizational Unit Name (eg, section) []:R.B.K
Common Name (eg, YOUR name) []:Jesse
Email Address []:jesse@gmail.com

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

3. Produce Certificate
#openssl x509 -req -days 3650 -sha1 -ext-file /etc/ssl/openssl.cnf -extensions v3_ca -signkey server.key -in server.req -out server.crt

4. Produce pem ( private key + certificate )
#cat server.key > server.pem
#cat server.crt >> server.pem

沒有留言:

張貼留言