虫言虫语 虫言虫语

本地自签证书测试https

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

参考文章: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/ buy cbd oil http://cbd-store.us.com/ - cbd cream buy cbd oil online

  2. Amitsflormror

    cbd drops http://buycbdoilonline.us.com/ - cbd vape cannabis oil hemp cbd oil

  3. swimarumTauff

    cannabis oil http://cbdcreamwww.com/ pure cbd oil cbd best cbd oil

  4. crapyragacoup

    http://cbdcreamww.com/ cbd for dogs http://cbdcreamww.com/ - cbd online pure cbd oil

  5. smagmevagype
    smagmevagype
    回复

    hemp cbd cbd store cbd pure hemp cbd oil

  6. Amitsflormror

    cbd oil benefits http://buycbdoilonline.us.com/ - best cbd oil buy cbd oil online hemp oil for pain hemp oil

  7. Russellweeme
    Russellweeme
    回复

    free cialis viagra without doctor prescription
    http://bestpricemedz.com/# buy generic cialis

  8. swimarumTauff

    cannabis oil http://cbdcreamwww.com/ - buy cbd cbd store cbd online cbd cream

  9. JamesTaids
    JamesTaids
    回复

    cialis ingredient cialis
    bestpricemedz.com generic viagra

  10. smagmevagype
    smagmevagype
    回复

    cbd products http://cbd-store.us.com/ - hemp oil for pain cbd oil for dogs cbd near me cbd pure

  11. crapyragacoup

    cbd gummies walmart hemp cbd hemp cbd medterra cbd

  12. swimarumTauff

    cbd online http://cbdcreamwww.com/ - buy cbd cbd oil store hemp oil

  13. LarryDruck
    LarryDruck
    回复

    viagra vs cialis generic viagra
    http://bestpricemedz.com/# generic viagra
    warnings for cialis generic viagra side effects for viagra

  14. crapyragacoup

    cbd oil store cbd hemp oil for pain

  15. JeromeErelm
    JeromeErelm
    回复

    http://bestpricemedz.com/# buy cialis

  16. crapyragacoup

    cbd near me http://cbdcreamww.com/ cbd vape cbd vape cbd oil for dogs

  17. crapyragacoup

    cbd gummies walmart http://cbdcreamww.com/ - cannabis oil cbd oils cbd cream

  18. zinjbred
    zinjbred
    回复

    essay
    james mattis essay
    https://writeessaywow.com/ - essay bot

  19. HKadlfked
    HKadlfked
    回复

    tadalafil 5 mg tablet https://www.edrxtab.com/buy-generic-levitra-online/ how long will sildenafil last Buy Generic Levitra Online is tadalafil covered by insurance https://www.edrxtab.com/buy-generic-levitra-online/

  20. HKadlfked
    HKadlfked
    回复

    tadalafil 5 mg tablet Buy Generic Levitra how long will sildenafil last https://www.edrxtab.com/buy-generic-levitra-online/ is tadalafil covered by insurance https://www.edrxtab.com/buy-generic-levitra-online/

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