From client I already have tls config which sets InsecureSkipVerify
to true. How to write server for this client which take any cert.
Can tls.config
help in server too? like setting InsecureSkipVerify
to true?
[golang]是否可以编写没有证书的TLS服务器?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- douxian7808 2017-02-16 08:01关注
No, as @JimB told you, TLS can't work without certificates.
The reasoning is simple: TLS is all about security, and certificates are cryptographic keys which provide that security (TLS uses a so-called "asymmetric cryptography" where each party has a key pair consisting of a private and public parts; the public part is what get sent to another party when doing a TLS handshake).
But on the other hand the security TLS provides is two-fold:
- It provides mutual authentication of the parties participating in the exchange.
- It provides encryption of the transmission channel.
Certificates are used for both aspects: the fact they contain cryptographic keys is used for (2), and the fact they have owner's identity encoded in them (and verified by whoever was issued a particular cercificate( is used for (1).
Let me not digress into discussing how (1) works in detail (though I truly urge you to read some theory on it) but (1) is what you actually want to sidestep.
The good (for you) thing is that it's cheaply doable:
- The TLS clients can be told to not verify the server's identity.
- The TLS servers can be told to do the same (and often it's the default mode they operate in—which is typical for regular websites for instance).
- You can create a so-called self-signed certificate for your TLS server.
The latter requires nothing but something which is able to generate X.509 certificates;
OpenSSL
is typically used for this; just google for it.If you're on Debian or Debian derivative (like Ubuntu, Mint etc) consider installing the
ssl-cert
package and using themake-ssl-cert
program it provides.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 DS18B20内部ADC模数转换器
- ¥15 做个有关计算的小程序
- ¥15 MPI读取tif文件无法正常给各进程分配路径
- ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
- ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
- ¥15 setInterval 页面闪烁,怎么解决
- ¥15 如何让企业微信机器人实现消息汇总整合
- ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
- ¥15 如何用Python爬取各高校教师公开的教育和工作经历
- ¥15 TLE9879QXA40 电机驱动