Share via


SslCertificateTrust.CreateForX509Store(X509Store, Boolean) 方法

定义

创建一个新的 SslCertificateTrust

public static System.Net.Security.SslCertificateTrust CreateForX509Store (System.Security.Cryptography.X509Certificates.X509Store store, bool sendTrustInHandshake = false);
static member CreateForX509Store : System.Security.Cryptography.X509Certificates.X509Store * bool -> System.Net.Security.SslCertificateTrust
Public Shared Function CreateForX509Store (store As X509Store, Optional sendTrustInHandshake As Boolean = false) As SslCertificateTrust

参数

store
X509Store

包含受信任证书的存储区。

sendTrustInHandshake
Boolean

true 表示服务器在 TLS 握手期间发送受信任的证书颁发机构列表; false 不发送列表。

返回

表示信任策略。

例外

sendTrustInHandshaketrue ,并且当前平台不支持在握手中发送受信任的颁发者列表,或者在 Windows 上 (,) store的位置不是 LocalMachine

注解

sendTrustInHandshake如果参数为 true,则客户端可以使用服务器中的受信任证书颁发机构列表来选择合适的客户端证书。 在 .NET 6 中,列表仅在 Windows 上发送,它取决于设置为 1 的“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\SendTrustedIssuerList”注册表设置。 自 .NET 7 起,该列表也会在 Linux 和 OSX 平台上发送。

警告

受信任的 CA 列表会增加握手消息的大小。 它还可能被视为有关系统配置的信息泄漏。 出于这些原因,建议将 设置为 sendTrustInHandshakefalse

适用于