ssl证书使用方法以及SSL证书的作用
2026-11-29 08:18:00

  无论是证L证作用申请免费的或CA签发的SSL证书,都需要安装生成后才能正常(chang)使用。书使书生成SSL证书的用方步骤从简单到复(fu)杂各不相(xiang)同。那接下来小编就给朋友们先讲述下一般ssl证书生成方法(fa)以及SSL证书的法及作用,想(xiang)要进一步了解ssl证书(shu)生成的证L证作用朋友们,赶紧过来看一下,书使(shi)书别错过了。用方  SSL证书生成  1.创建根证书密钥文件(jian):  open="open"ssl genrsa -des3 -out root.key  输出内容为:  [lenin@archer ~]$ open=""ssl genrsa -des3 -out root.keyGenerating RSA private key,法及 512 bit long modulus……………..++++++++++++..++++++++++++e is 65537 (0×10001)Enter pass phrase for root.key: ← 输入(ru)一个新密码Verifying – Enter pass phrase for root.key: ← 重新输入一遍密码  2.创建根证书的申请文件(jian)root.csr:  openssl req -new -key root.key -out root.csr  输出内(nei)容为:  [lenin@archer ~]$ open="open"ssl req -new -key root.key -out root.csrEnter pass phrase for root.key: ← 输入前面创建的密码You are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter ‘.’, the field will be left blank.—–Country Name (2 letter code) [AU]:CN ← 国家代号,中国输入(ru)CNState or 证L证作用Province Name (full name) [Some-State]:BeiJing ← 省的全名,拼音Locality Name (eg,书使(shi)书 city) []:BeiJing ← 市的全名,拼音Organization Name (eg,用方 company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名(ming)Organizational Unit Name (eg, section) []: ← 可以(yi)不输入Common Name (eg, YOUR name) []: ← 此时不输入Email Address []:admin@mycompany.com ← 电子邮箱,可随意(yi)填  Please enter the following ‘extra’ attributesto be 法(fa)及sent with your certificate requestA challenge password []: ← 可以不输入An optional company name []: ← 可(ke)以不输入  3.创建一个自当前日(ri)期起为期一年的根证书root.crt:  open=""ssl x509 -req -days 365 -sha1 -extensions v3_ca -signkey root.key -in root.req -out root.crt  输出内容为:  [lenin@archer ~]$ openssl x509 -req -days 365 -sha1 -extensions v3_ca -signkey root.key -in root.csr -out root.crtSignature oksubject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./emailAddress=admin@mycompany.comGetting Private keyEnter pass phrase for root.key: ← 输入前面创建的(de)密码  4.创建服务器证书密钥server.key:  open='open'ssl genrsa –des3 -out server.key 2048  输出(chu)内容为:  [lenin@archer ~]$ open=""ssl genrsa -out server.key 2048Generating RSA private key, 2048 bit long modulus….+++…………………………………………..+++e is 65537 (0×10001)  运行时会提示(shi)输入密码,此密码用于加密key文件(参数des3便是指加密算法,当(dang)然也可以选用其他你认为安全(quan)的算法.),以后每当需读取此文件(通(tong)过openssl提供的(de)命令或(huo)API)都需输入口令.如(ru)果觉得不(bu)方便,也可以去除这个口令,但一定要采取其他的保护措施!去除key文件(jian)口令的命令:open=""ssl rsa -in server.key -out server.key  5.创建服务器证书的申请文件server.csr:  open="open"ssl req -new -key server.key -out server.csr  输出内容为:  [lenin@archer ~]$ open=""ssl req -new -key server.key -out server.reqYou are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter ‘.’, the field will be left blank.—–Country Name (2 letter code) [AU]:CN ← 国家(jia)名称,中(zhong)国输入CNState or 证L证作(zuo)用Province Name (full name) [Some-State]:BeiJing ← 省名,拼音Locality Name (eg,书使书 city) []:BeiJing ← 市名,拼音Organization Name (eg,用方 company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名Organizational Unit Name (eg, section) []: ← 可以不输入Common Name (eg, YOUR name) []:www.mycompany.com ← 服务器主机名,若填写不正确,浏览器会报告证书无(wu)效,但并不影响使用Email Address []:admin@mycompany.com ← 电子邮箱,可随便填  Please enter the following ‘extra’ attributesto be sent with your certificate requestA challenge password []: ← 可以不输入An optional company name []: ← 可以不输入  6.创建自当前日期(qi)起有效期为期两年的服务器证书server.crt:  open='open'ssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in server.csr -out server.crt  输出内容为:  [lenin@archer ~]$ open='open'ssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAcreateserial -in server.csr -out server.crtSignature oksubject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./CN=www.mycompany.com/emailAddress=admin@mycompany.comGetting CA Private KeyEnter pass phrase for root.key: ← 输入(ru)前面创建的密码  7.创建客户端证书密钥文件client.key:  open="open"ssl genrsa -des3 -out client.key 2048  输出内容为:  [lenin@archer ~]$ open='open'ssl genrsa -des3 -out client.key 2048Generating RSA private key, 2048 bit long modulus……………………………………………………………………………..+++……………………………………………………………………………………………………….+++e is 65537 (0×10001)Enter pass phrase for client.key: ← 输入一个(ge)新密码Verifying – Enter pass phrase for client.key: ← 重新输入(ru)一遍密码  8.创建客户端证书的申请文(wen)件client.csr:  open="open"ssl req -new -key client.key -out client.csr  输出内容为:  [lenin@archer ~]$ open="open"ssl req -new -key client.key -out client.csrEnter pass phrase for client.key: ← 输入上一步中创建的密码You are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter ‘.’, the field will be left blank.—–Country Name (2 letter code) [AU]:CN ← 国家名称,中(zhong)国输入CNState or Province Name (full name) [Some-State]:BeiJing ← 省名称,拼音Locality Name (eg, city) []:BeiJing ← 市名称,拼音Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名Organizational Unit Name (eg, section) []: ← 可以不(bu)填Common Name (eg, YOUR name) []:Lenin ← 自己的英文名,可以(yi)随便填Email Address []:admin@mycompany.com ← 电子邮箱,可以随便填  Please enter the following ‘extra’ attributesto be sent with your certificate requestA challenge password []: ← 可以不填An optional company name []: ← 可以不填  9.创建一个自当前日期起有效期为两年的客户端证书client.crt:  open=""ssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in client.csr -out client.crt  输出内容为:  [lenin@archer ~]$ openssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAcreateserial -in client.csr -out client.crtSignature oksubject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./CN=www.mycompany.com/emailAddress=admin@mycompany.comGetting CA Private KeyEnter pass phrase for root.key: ← 输入上面创建的(de)密码  10.将客户端证书文件client.crt和客户端证书密钥文(wen)件client.key合并成客(ke)户端证书安装(zhuang)包client.pfx:  open=""ssl pkcs12 -export -in client.crt -inkey client.key -out client.pfx  输出内容为:  [lenin@archer ~]$ open="open"ssl pkcs12 -export -in client.crt -inkey client.key -out client.pfxEnter pass phrase for client.key: ← 输入上面创建的密码Enter Export Password: ← 输入一个新的密码,用作客户端证书的保护密码,在客(ke)户端安装证书时需(xu)要输入此密码Verifying – Enter Export Password: ← 确认密码  11.保存生成的文件备用,其中server.crt和server.key是配置单向SSL时需要使用的证书文件,client.crt是配置双向SSL时需要使用的证书文件,client.pfx是配置双向SSL时(shi)需要客(ke)户端安装的证书文件  .crt文件和.key可以合到一个文件里面,把2个(ge)文件合成了一个.pem文件(直接拷贝过去(qu)就行了) ssl证书生成  SSL证书的作用  SSL证书是数字证书的一种,类似于驾驶证、护照和营业执照的电子副本。  SSL证书(shu)的两大作用(yong):数据加密和身份认证  SSL 证书遵守 SSL协议,通过在客户端浏览器和(he)Web服务器之间建立一条新网SSL安全(quan)通道  一个(ge)有(you)效、可信的 SSL 数字证书包括一个公共密钥和一个私用密钥。公共密钥用于加密信息,私用密钥用于解译加密的信息。因(yin)此(ci),浏览器指向一个(ge)安全域时,SSL 将同步确(que)认服务器(qi)和(he)客户端,并创建(jian)一种新网加密方式和(he)一个唯一的会话密钥。它们可以启动一个保证消息的隐私性和完整性的安全会话。 ssl证书(shu)生成  SSL证书(shu)包括  1,CA证书,也叫根证书或者中间级证(zheng)书。如果是单向https认证的话,该证书是可(ke)选的。不安装CA证书的话,浏览器默认是不安全的。  2,服务器(qi)证书(shu),必选项。通过key,证(zheng)书请求文件(jian)csr,再通过CA证书签名,生成(cheng)服务器证书。  以上就是ssl证书生(sheng)成方法以及SSL证书的作用,对于SSL证书安装步骤相对(dui)简单。但是OV SSL和EV SSL证书的安装就相对比较复杂了,数据审计也比较严格。如果不了解这方面,建议还是找专业人士帮忙安装(zhuang)。

ssl证书使用方法以及SSL证书的作用

(作者:网站建设)