虫言虫语 虫言虫语

本地自签证书测试https

in 默认分类read (9586) 文章转载请注明来源!

参考文章:https://www.2cto.com/article/201510/444706.html
生成密钥、证书
第一步,为服务器端和客户端准备公钥、私钥

生成服务器端私钥 openssl genrsa -out server.key 1024

生成服务器端公钥 openssl rsa -in server.key -pubout -out server.pem

生成客户端私钥 openssl genrsa -out client.key 1024

生成客户端公钥 openssl rsa -in client.key -pubout -out client.pem 第二步,生成 CA 证书

生成 CA 私钥 openssl genrsa -out ca.key 1024

X.509 Certificate Signing Request (CSR) Management. openssl req -new -key ca.key -out ca.csr

X.509 Certificate Data Management. openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt 在执行第二步时会出现:

➜ keys 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) [AU]:CN State or Province Name (full name) [Some-State]:Zhejiang Locality Name (eg, city) []:Hangzhou
Organization Name (eg, company) [Internet Widgits Pty Ltd]:My CA
Organizational Unit Name (eg, section) []: Common Name (e.g. server
FQDN or YOUR name) []:localhost Email Address []:

注意,这里的 Organization Name (eg, company) [Internet Widgits Pty Ltd]: 后面生成客户端和服务器端证书的时候也需要填写,不要写成一样的!!!可以随意写如:My CA, My Server, My Client。

然后 Common Name (e.g. server FQDN or YOUR name) []: 这一项,是最后可以访问的域名,我这里为了方便测试,写成 localhost ,如果是为了给我的网站生成证书,需要写成 barretlee.com 。

第三步,生成服务器端证书和客户端证书

服务器端需要向 CA 机构申请签名证书,在申请签名证书之前依然是创建自己的 CSR 文件 openssl req -new -key server.key -out server.csr

向自己的 CA 机构申请证书,签名过程需要 CA 的证书和私钥参与,最终颁发一个带有 CA 签名的证书 openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt

client 端 openssl req -new -key client.key -out client.csr

client 端到 CA 签名 openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in client.csr -out client.crt

jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

扫描二维码,在手机上阅读!

发表新评论
已有 2795 条评论
  1. swimarumTauff

    best cbd oil buy cbd oil http://cbdcreamwww.com/ - cbd oils cbd tinctures cbd pure

  2. smagmevagype
    smagmevagype
    回复

    cbd capsules http://cbd-store.us.com/ - buy cbd oil online buy cbd cbd gummies walmart cbd products

  3. swimarumTauff

    cbd pure http://cbdcreamwww.com/ hemp cbd cannabis oil cbd gummies

  4. Traddiiou
    Traddiiou
    回复

    n26 kredit http://onlinesofortkredite.org/100000-euro-kredit
    kredit ohne schufa auskunft http://onlinesofortkredite.org/100000-euro-kredit kredit auto
    http://onlinesofortkredite.org/100000-euro-kredit

  5. Traddiiou
    Traddiiou
    回复

    ing diba kredit http://onlinesofortkredite.org/75000-euro-kredit
    kredit ohne bonitatsprufung http://onlinesofortkredite.org/75000-euro-kredit kfz kredit
    http://onlinesofortkredite.org/75000-euro-kredit

  6. Traddiiou
    Traddiiou
    回复

    kredit 24 sofort http://onlinesofortkredite.org/
    santander bank kredit http://onlinesofortkredite.org/ postbank kredit aufstocken
    http://onlinesofortkredite.org/

  7. ttkgired
    ttkgired
    回复

    essay format
    essay writer
    https://writeessaywow.com/ - james mattis essay

  8. smagmevagype
    smagmevagype
    回复

    cbd oil store hemp cbd oil cbd

  9. Amitsflormror

    http://buycbdoilonline.us.com/ cbd online cbd oil benefits hemp cbd oil cbd for sale

  10. swimarumTauff

    cbd capsules cbd cream cbd oils medterra cbd http://cbdcreamwww.com/ - cbd pills

  11. JamesTaids
    JamesTaids
    回复

    generic cialis tadalafil generic cialis and cheap cialis and cialis generic and cheap cialis and cialis vs viagra and buy generic cialis
    http://120.78.129.176/home.php?mod=space&uid=49727 generic cialis

  12. crapyragacoup

    http://cbdcreamww.com/ hemp oil for pain buy cbd cbd capsules cbd online

  13. swimarumTauff

    cbd capsules http://cbdcreamwww.com/ - cbd best cbd oil cbd oil for sale

  14. Uidjyiiou
    Uidjyiiou
    回复

    schweizer kredit [url=http://onlinesofortkredite.org/50000-euro-kredit#]http://onlinesofortkredite.org/50000-euro-kredit[/url]
    norisbank kredit http://onlinesofortkredite.org/50000-euro-kredit deutsche bank kredit
    http://onlinesofortkredite.org/50000-euro-kredit

  15. smagmevagype
    smagmevagype
    回复

    cbd tinctures cbd store cbd products cbd store http://cbd-store.us.com/ - cbd pure

  16. swimarumTauff

    hemp cbd oil http://cbdcreamwww.com/ - cbd drops pure cbd oil hemp oil

  17. Victorjunty
    Victorjunty
    回复

    viagra vs cialis cialis coupon and cialis coupon and generic cialis and cialis 20mg and cialis price and cialis 20mg
    http://www.multiple-avenues.com/forums/member.php?281505-ubzixhym buy generic cialis

  18. DennisMousy
    DennisMousy
    回复

    what is cialis generic cialis and cialis and buy cialis and cialis 20mg and generic cialis and cialis price
    http://szcq.net.cn/home.php?mod=space&uid=71216 cialis coupon

  19. Anthonyfut
    Anthonyfut
    回复

    real cialis online with paypal cialis online and buy generic cialis and cialis 20mg and cialis online and buy cialis online and cialis 20mg canadian cialis cialis 20mg and cialis and buy cialis online and cialis 20mg and cialis price and buy cialis
    http://www.linglipx.com/home.php?mod=space&uid=792334 cialis online

  20. JesusFed
    JesusFed
    回复

    nose congested when taking cialis cialis and buy cialis and buy generic cialis and cialis and cialis price and cialis online
    http://it776.com/home.php?mod=space&uid=2134766 buy cialis

博客已萌萌哒运行
© 2020 由 Typecho 强力驱动.Theme by Yodu
前篇 后篇
雷姆
拉姆