【发布时间】:2021-08-16 23:34:50
【问题描述】:
我正在尝试侦听端口上的安全 TCP 连接。我正在浏览微软文档上的服务器代码示例。我在这里粘贴以供快速参考:
static void ProcessClient (TcpClient client)
{
// A client has connected. Create the
// SslStream using the client's network stream.
SslStream sslStream = new SslStream(
client.GetStream(), false);
// Authenticate the server but don't require the client to authenticate.
try
{
sslStream.AuthenticateAsServer(serverCertificate, clientCertificateRequired: false, checkCertificateRevocation: true);
// Display the properties and settings for the authenticated stream.
DisplaySecurityLevel(sslStream);
DisplaySecurityServices(sslStream);
DisplayCertificateInformation(sslStream);
DisplayStreamProperties(sslStream);
我的疑问是为什么服务器要对自己进行身份验证?还是我在这里遗漏了什么。
【问题讨论】:
标签: c# authentication server certificate sslstream