Skip to content

Instantly share code, notes, and snippets.

@huacnlee
Created August 3, 2010 01:21
Show Gist options
  • Save huacnlee/505665 to your computer and use it in GitHub Desktop.
Save huacnlee/505665 to your computer and use it in GitHub Desktop.
# Linux 创建 SSL 证书的方法
[huacnlee@ubuntu-server]$ sudo openssl genrsa -out ca.key
Generating RSA private key, 512 bit long modulus
...........++++++++++++
.++++++++++++
e is 65537 (0x10001)
[huacnlee@ubuntu-server]$ sudo openssl req -new -key ca.key -out ca.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]:US
State or Province Name (full name) [Berkshire]:California
Locality Name (eg, city) [Newbury]:
Organization Name (eg, company) [My Company Ltd]:Huacnlee
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:dabr.huacnlee.com
Email Address []:[email protected]
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:Huacnlee
[huacnlee@ubuntu-server]$ sudo openssl x509 -req -days 3650 -in ca.csr -signkey ca.key -out ca.crt
Signature ok
subject=/C=US/ST=California/L=Newbury/O=Huacnlee/CN=dabr.huacnlee.com/[email protected]
Getting Private key
sudo openssl genrsa -out ca.key
sudo openssl req -new -key ca.key -out ca.csr
sudo openssl x509 -req -days 3650 -in ca.csr -signkey ca.key -out ca.crt
此方法将不适用密码,最后会在目录下面生成 ca.key, ca.crt 和 ca.csr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment