虫言虫语 虫言虫语

本地自签证书测试https

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 26171 条评论
  1. cialifS
    cialifS
    回复

    [url=https://cialisgf.com/]buy cialis canadian[/url] cialis euroclinix

  2. cialifS
    cialifS
    回复

    buy cialis toronto cialis brand in india

  3. SueDes
    SueDes
    回复

    sildenafil buy online india seroquel canada price tretinoin 0.5 cream price in india augmentin 800 cheap pharmacy no prescription propecia 1mg generic how to get furosemide arimidex tablets 1mg 80 mg tadalafil cialis 20mg india

  4. JamesEsorn
    JamesEsorn
    回复

    buy generic viagra here buy medication without an rx
    impotence treatment http://genericvgrshop.com viagra Without a Doctor Prescription
    buy cheap prescription viagra online buying prescription viagra from canada

  5. where to buy cialis 10mg

    rogaine 5% united kingdom rogaine 5% cheap rogaine uk

  6. AnnaDes
    AnnaDes
    回复

    generic cialis soft tabs online best online viagra buy avodart online canada generic cialis 2.5 mg buy viagra online uk top 10 pharmacy websites tadalafil 20mg from india

  7. cialifS
    cialifS
    回复

    buy cialis tadalafil tablets research chemicals cialis

  8. cializS
    cializS
    回复

    cialis tadalafil portugal cortar pastilla cialis

  9. NickDes
    NickDes
    回复

    cheap cialis 100mg 200 mg lasix order atarax online sildenafil generic purchase prednisone tablets india pharmacy tretinoin

  10. AmyDes
    AmyDes
    回复

    clomid 100mg tablets

  11. JamesEsorn
    JamesEsorn
    回复

    meds without a doctor prescription buy prescription viagra
    buy drug online http://genericvgrshop.com buy viagra very cheap
    generic viagra without a doctor prescription buy cheap prescription viagra online

  12. canadian pharmacies without prescriptions uohoaq

    metoprolol online prescription drugs canadian government approved pharmacies
    canadian levitra viagra soft tabs

  13. demedvgrnualf

    viagra und co viagra preis was ist eine viagra
    was passiert wenn frau viagra

  14. best canadian pharmacies

    top rated canadian online pharmacy
    http://canadiannextpharmacy.com/
    canada drug

  15. FbgAstew
    FbgAstew
    回复

    viagra 100 mg viagra prescription savings program viagra australia https://canadianpharmacy-usx.com/organic.htm - generic canadian viagra 24 medic ’

  16. cialifS
    cialifS
    回复

    [url=https://cialisgf.com/]buy cialis insurance[/url] buy cialis gold coast

  17. canada drugs online review

    reputable online pharmacy
    http://canadianpharmacieshq.com/
    overseas pharmacies

  18. JamesEsorn
    JamesEsorn
    回复

    viagra Without a Doctor Prescription generic viagra for sale
    ed in young men http://genericvgrshop.com buy viagra very cheap
    generic viagra meds without a doctor prescription

  19. certified canadian online pharmacies

    canadian trust pharmacy
    http://canadiannextpharmacy.com/
    canadian pharmacy

  20. demedvgrnualf

    frauen viagra viagra preis viagra vom hausarzt verschreiben lassen
    warum ist viagra rezeptpflichtig?

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