虫言虫语 虫言虫语

本地自签证书测试https

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 3082 条评论
  1. custom
    custom
    回复

    Indian tablets for women .

  2. RebPrutle
    RebPrutle
    回复

    How Strong Is 250 Grams O Amoxicillian cialis prices Cialis Frei Kaufen Generic Tadalis Sx Soft Omnigen

  3. RebPrutle
    RebPrutle
    回复

    Brand Viagra Online Canadian Pharmacy Cialis From Usa cialis cheapest online prices Viagra Sildenafil Preisvergleich

  4. RebPrutle
    RebPrutle
    回复

    Cellcept Atomoxetine Online Propecia Atrapalo cialis 40 mg Amoxicillin Side Effect In Toddlers

  5. RebPrutle
    RebPrutle
    回复

    Safe To Buy Viagra Online Over The Counter Cephalexin tadalafil cialis from india Acquistare Cialis Italia Propecia Relax

  6. RebPrutle
    RebPrutle
    回复

    Real Elocon Online In Canada Cephalexin Pets Acheter Lioresal Ligne viagra Buy Doxycycline In Mexico

  7. Stevnisa
    Stevnisa
    回复

    247 Drug Shop Buy Cialis Cheap Drugs Canada Propecia En Perros Comprar Cialis Ecuador

  8. Kelsype
    Kelsype
    回复

    Can You Take Amoxicillin With Tylenol Buy Cialis Priligy Stories

  9. Kelsype
    Kelsype
    回复

    Discount Levaquin Online Saturday Delivery How Much Does Generic Tadalafil Cost Cialis Diaria Cialis Trouver Nolvadex Kamagra Oral Jelly Paris

  10. MatExcupe
    MatExcupe
    回复

    Online Clobetasol Where Can I Buy http://cialibuy.com - Cialis Keflex Creatinine Cialis Sucrallfate Buy In England

  11. Kelsype
    Kelsype
    回复

    Stendra Ed Best Website http://cialibuy.com - buy generic cialis online Vigrra Chemist On Line Buy Cialis Shipped Ups Doxycycline

  12. Kelsype
    Kelsype
    回复

    Levitra Prezzo In Erboristeria http://cialibuy.com - cialis prices Ic Cephalexin Drug Info Cialis Isotretinoin Find

  13. Lesswesty
    Lesswesty
    回复

    Foro Priligy Espana http://cialibuy.com - Buy Cialis Keflex And Side Effects And Interactions Cialis Purchase 5mg Cialis

  14. MatExcupe
    MatExcupe
    回复

    Comprar Cialis Online Foro http://cialibuy.com - Buy Cialis No Rx Needed Cialis Cialis 10 Mg Wirkung

  15. Lesswesty
    Lesswesty
    回复

    Viagra Schweiz http://cheapcialisir.com - where to buy cialis online safely Buy Meloxicam Cialis Hplc Amoxicillin Protocols

  16. MatExcupe
    MatExcupe
    回复

    Rx Express Online http://cialisir.com - Cialis Amoxicilina Discount Pills By Money Order cialis for sale Viagra Nutzt Nichts

  17. Lesswesty
    Lesswesty
    回复

    Cephalexin For Urinary Tract Infection http://buyciallisonline.com - Cialis Viagra Marseille Cialis Efectos Del Viagra A Largo Plazo

  18. Lesswesty
    Lesswesty
    回复

    Buy Doxycycline No Prescription Online http://ggenericcialisle.com - Buy Cialis Commander Viagra Pharmacie п»їcialis Least Expensive Viagra Prescription

  19. MatExcupe
    MatExcupe
    回复

    Can Amoxicillin Cause A Stuffy Nose http://buyciallisonline.com/#514 - Cialis Nolvadex 20mg Cialis Priligy Bijwerkingen

  20. Lesswesty
    Lesswesty
    回复

    Venta De Kamagra Sin Receta http://ggenericcialisle.com - Buy Cialis Acheter Du Cialis En Allemagne Buy Cialis Kamagra Suisse

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