在客户端和服务器(非 HTTPS)之间使用自定义协议时是否需要 SSL 证书?

Is SSL Certificate required when using custom protocols between client and server (Not HTTPS)?

我有一个正在处理的项目,它是一个桌面应用程序,它与我通过 TCP 构建的服务器进行通信。我想使用 SSL (TLS) 确保连接安全和加密,但我不确定在自定义协议中使用 SSL 时是否需要 SSL 证书?是否仅适用于 HTTPS,因为它需要它?

另外,我想知道SSL证书在2个端点之间的流加密过程中的作用是什么?是否仅用于验证 2 个端点?

提前致谢。

... is SSL Certificate required when using SSL in custom protocols?

证书用于识别服务器,即确保客户端连接到预期的服务器而不是中间的某个人。 TLS 还提供了其他方法来进行这种检查,例如在客户端和服务器之间使用 pre-shared 秘密,有关更多信息,请参阅 Wikipedia: TLS-PSK

I'd like to know what is the role of the SSL Certificate in the encryption process of the stream between the 2 endpoints? Is it just for verifying the 2 endpoints?

证书的主要作用是提供身份验证。通过 RSA 密钥交换,证书还用于将对称加密密钥的信息从客户端传输到服务器 - 通过使用从证书中获取的服务器 public 密钥加密 pre-master 秘密,以便服务器可以使用匹配的私钥对其进行解密。但请注意,RSA 密钥交换被认为已过时,并且在现代密钥交换方法 (Diffie-Hellman) 中不使用证书。