虫言虫语 虫言虫语

本地自签证书测试https

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

参考文章: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. smagmevagype
    smagmevagype
    回复

    http://cbd-store.us.com/ cannabis oil best cbd oil buy cbd oil hemp oil for pain cbd for dogs

  2. Kioajdfhf
    Kioajdfhf
    回复

    cialis tadalafil 20 mg https://www.edpillole.com/acquisto-levitra-online-sicuro/ which is better sildenafil or tadalafil https://www.edpillole.com/acquisto-levitra-online-sicuro/ sildenafil side effects https://www.edpillole.com/acquisto-levitra-online-sicuro/

  3. swimarumTauff

    cbd vape http://cbdcreamwww.com/ cbd oil at walmart buy hemp oil cbd near me

  4. smagmevagype
    smagmevagype
    回复

    http://cbd-store.us.com/ cbd for sale cbd gummies cbd near me cdb oils

  5. crapyragacoup

    http://cbdcreamww.com/ cbd oil store http://cbdcreamww.com/ - cbd oil online cbd near me

  6. swimarumTauff

    http://cbdcreamwww.com/ cbd oil benefits http://cbdcreamwww.com/ - buy hemp oil cbd vape

  7. smagmevagype
    smagmevagype
    回复

    cdb oils buy hemp oil cbd capsules cbd oils

  8. crapyragacoup

    cbd hemp http://cbdcreamww.com/ - cbd tinctures cbd oil cbd

  9. swimarumTauff

    http://cbdcreamwww.com/ cbd cbd oil benefits best cbd oil buy cbd oil cbd products

  10. wlxutred
    wlxutred
    回复

    essay
    essay format
    https://writeessaywow.com/ - essay bot

  11. crapyragacoup

    cbd oil online http://cbdcreamww.com/ cbd near me buy cbd oil cbd oil

  12. swimarumTauff

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

  13. smagmevagype
    smagmevagype
    回复

    http://cbd-store.us.com/ cbd oil online http://cbd-store.us.com/ - cbd online cbd oil benefits

  14. Amitsflormror

    cbd gummies walmart http://buycbdoilonline.us.com/ cbd oil for pain cbd for dogs cbd oil for dogs

  15. smagmevagype
    smagmevagype
    回复

    hemp cbd oil hemp cbd cbd medic cbd pills

  16. Russellweeme
    Russellweeme
    回复

    price of cialis generic cialis and buy cialis and cheap cialis and generic cialis and cialis without doctor prescription and cialis
    http://luntan.wangwangyutang.com/home.php?mod=space&uid=48586 cialis generic

  17. JeromeErelm
    JeromeErelm
    回复

    cialis 20 mg best price viagra without doctor prescription and cheap cialis and cheap cialis and generic viagra and cialis generic and buy generic cialis
    http://zycqw.org/home.php?mod=space&uid=179668 cialis generic

  18. Amitsflormror

    best cbd oil buy cbd oil cbd near me cbd oil for pain cbd medic

  19. crapyragacoup

    http://cbdcreamww.com/ cbd hemp http://cbdcreamww.com/ - best cbd oil cbd vape

  20. smagmevagype
    smagmevagype
    回复

    hemp cbd oil http://cbd-store.us.com/ cbd pills buy cbd oil online cbd for sale

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