dongqianchi0512
2017-01-31 17:00
浏览 213
已采纳

如何在Golang中编写HTTP服务器无证书?

I am trying to write a server logic which takes 'https' request but client does not have any certificate, how do I write it?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试编写一个接受“ https”请求但客户端没有任何证书的服务器逻辑,怎么办 我写的吗?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanhe1903 2017-01-31 17:33
    已采纳

    This could go two different directions depending on what you're actually asking.

    If you're asking how to host https requests without the server having a certificate, that's impossible. https requests mean that the connection is secured by SSL/TLS, which necessarily requires a server certificate to function.

    If you're asking how to host https requests without requiring clients to have certificates, that's another matter, and in fact is the default behavior of the http.Server. You actually have to set the https.Server field ClientAuth (for example, to http.RequireAndVerifyClientCert) in order to actually require those certs. If you don't set this field, the default value is http.NoClientCert, which allows client connections without certificates, and doesn't validate the certs even if they are presented.

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • doumuyu0837 2017-01-31 17:11

    Https requests require SSL Certificates.. you can create a self signed one, but you should get a real, valid certificate for any production ready server.

    Just 1 way to make a self signed cert: https://devcenter.heroku.com/articles/ssl-certificate-self

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题