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

如何在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?

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换