虫言虫语 虫言虫语

本地自签证书测试https

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

参考文章: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

支付宝打赏

文章二维码

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

发表新评论
已有 2259 条评论
  1. HerbertFluow
    HerbertFluow
    回复

    http://cialisxtl.com/# cialis 20 mg best price
    viagra or cialis cialis in canada cialis price

  2. RafSeinaclecoca

    cbd oil benefits http://buycbdoilonline.us.com/ cbd cbd pills hemp oil

  3. innodield
    innodield
    回复

    hemp oil for pain cbd oil cannabis oil hemp oil http://cbdoilrx.us.com/ - cbd medic

  4. cedlemn
    cedlemn
    回复

    cialis pills for sale generic cialis
    http://cialisxtl.com/# herbal replacement for viagra/cialis/levitra...
    5 mg cialis coupon printable buy cialis online canadian

  5. HerbertFluow
    HerbertFluow
    回复

    http://cialisxtl.com/# free cialis
    cialis money order cialis erections cialis before and after

  6. Jamesbah
    Jamesbah
    回复

    buy cialis london http://cialisxtl.com
    viagra buy usa

  7. JasonCex
    JasonCex
    回复

    http://cialisxtl.com/# generic cialis without prescription
    liquid cialis
    how much does cialis cost at walmart cialis money order

  8. cedlemn
    cedlemn
    回复

    30 day cialis trial offer here
    http://cialisxtl.com/# online cialis
    online cialis generic cialis black 800mg

  9. HerbertFluow
    HerbertFluow
    回复

    http://cialisxtl.com/# cialis 20 image
    where to get cialis sample cialis money order viagra vs cialis

  10. cedlemn
    cedlemn
    回复

    generic names for cialis and viagra buy cialis
    http://cialisxtl.com/# generic cialis bitcoin
    otc cialis lowest cialis prices

  11. jxfugred
    jxfugred
    回复

    generic levitra levitra coupon levitra online levitra coupon order levitraorder levitra levitra com levitra 10mg generic levitra levitra dosagehttps://drugstoreonliner.com/ - levitra pills

  12. Jamesbah
    Jamesbah
    回复

    discount viagra professional http://cialisxtl.com
    discount cialis and viagra

  13. HerbertFluow
    HerbertFluow
    回复

    http://cialisxtl.com/# how much does cialis cost at walmart
    $200 cialis coupon cialis lowest price generic cialis bitcoin

  14. JasonCex
    JasonCex
    回复

    http://cialisxtl.com/# cialis online
    low cost cialis
    cialis ingredient real cialis online with paypal

  15. cedlemn
    cedlemn
    回复

    what are the side effects of cialis buy here
    http://cialisxtl.com/# current cost of cialis 5mg cvs
    cialis generic does viagra or cialis help with pe

  16. RafSeinaclecoca

    cbd gummies walmart http://buycbdoilonline.us.com/ buy cbd cbd products medterra cbd

  17. innodield
    innodield
    回复

    cbd oil cbd tinctures cbd pure

  18. cedlemn
    cedlemn
    回复

    real cialis online with paypal here
    http://cialisxtl.com/# interactions for cialis
    viagra vs cialis vs levitra hard erections cialis

  19. HerbertFluow
    HerbertFluow
    回复

    http://cialisxtl.com/# $200 cialis coupon
    $200 cialis coupon cialis 100 mg lowest price cheapest cialis

  20. Jamesbah
    Jamesbah
    回复

    viagra for sale at tesco http://cialisxtl.com
    where to buy cheap viagra in uk

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