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条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度