虫言虫语 虫言虫语

本地自签证书测试https

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

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

支付宝打赏

文章二维码

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

发表新评论
已有 2260 条评论
  1. RafSeinaclecoca

    cbd near me http://buycbdoilonline.us.com/ - pure cbd oil cbd pills pure cbd oil buy hemp oil

  2. Lizaobete
    Lizaobete
    回复

    http://realtyempire.in/wp/2020/03/03/dealing-with-debt-collectors-7/?unapproved=209021&moderation-hash=4ebe04d9e05a74ca289c9ee9284f5bf7 - cheap viagrabuy viagrahttps://smoothdecorator.com/transform-outdoor-area-without-breaking-bank/?unapproved=10872&moderation-hash=dba355831e9cd2e66507741563565402 - buy viagraviagrahttps://tambakrejo.desakupemalang.id/2017/03/rapat-tim-penyusun-bumdes-rejo-lestari-tahap-ii/?unapproved=618&moderation-hash=831fc92a54a47a8b28ed77220d0acf2e - cialischeap cialishttp://theteacherplace.us/2014/12/sample-ecorhetorical-composition-assignments/?unapproved=9657&moderation-hash=17088f47357207c7631329b470742a8f - cialis onlinecialishttp://www.yasglobalservices.com/2020/03/04/a-fight-between-native-american-lenders-and-the-10/?unapproved=4345&moderation-hash=138e6a7957e9cefeade54ec522387321 - viagraviagrahttps://www.med-spa.ro/vedet/?unapproved=25872&moderation-hash=d4b2742e3d512c7d6866d456c20450d0 - viagra onlinebuy viagrahttps://www.tottiposports.com/2020/03/03/how-do-payday-loans-work-dangers-payday-loan-50/?unapproved=2650&moderation-hash=48debdc0adc55ff2048ff92405d584a2 - buy viagraviagra

  3. Stevedal
    Stevedal
    回复

    https://sildenafilprof.com viagra on line
    generic viagra available cheap viagra п»їviagra

  4. JeffreyHog
    JeffreyHog
    回复

    https://sildenafilprof.com viagra 100mg
    viagra cost per pill sildenafil how long does viagra last

  5. ScottJut
    ScottJut
    回复

    what is viagra: https://sildenafilprof.com viagra side effects

  6. Coxrounny
    Coxrounny
    回复

    viagra substitute over counter viagra
    https://sildenafilprof.com viagra 100mg
    viagra in action buy viagra generic viagra prices

  7. Hennaobete
    Hennaobete
    回复

    be0031 viagra generico similareshttp://viagraaqwe.com/ viagra in costa ricahttp://viagrauyr.com/

  8. Stevedal
    Stevedal
    回复

    https://sildenafilprof.com generic viagra india 100mg
    viagra coupon viagra without a doctor prescription viagra pill

  9. JeffreyHog
    JeffreyHog
    回复

    https://sildenafilprof.com viagra vs cialis
    how long does viagra last over the counter viagra natural viagra alternatives that work

  10. ScottJut
    ScottJut
    回复

    viagra side effects: https://sildenafilprof.com viagra samples

  11. smagmevagype
    smagmevagype
    回复

    cbd oil for sale buy cbd cbd capsules cbd medic

  12. crapyragacoup

    buy cbd http://cbdoilstore.us.com/ - best cbd oil buy cbd oil pure cbd oil cbd gummies

  13. Coxrounny
    Coxrounny
    回复

    best price 100mg generic viagra generic viagra
    https://sildenafilprof.com viagra samples from pfizer
    cheapest viagra generic viagra when will generic viagra be available

  14. swimarumTauff

    buy cbd oil http://cbd-oils.us.com/ - cbd oil store cbd cream cbd gummies walmart

  15. Amitsflormror

    best cbd oil buy cbd oil cbd for dogs cbd capsules

  16. Stevedal
    Stevedal
    回复

    https://sildenafilprof.com viagra without doctor prescription
    free viagra sildenafil revatio vs viagra

  17. JeffreyHog
    JeffreyHog
    回复

    https://sildenafilprof.com women viagra
    viagra alternatives viagra trial samples of viagra

  18. ScottJut
    ScottJut
    回复

    viagra side effects: https://sildenafilprof.com viagra erection

  19. smagmevagype

    cbd oil at walmart http://cbd-online.us.com/ - medterra cbd cbd gummies walmart cbd oil buy cbd oil

  20. crapyragacoup

    hemp cbd oil best cbd oil cbd oil online

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