Share via


SslCertificateTrust.CreateForX509Collection 方法

定义

创建一个新的 SslCertificateTrust

[System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
public static System.Net.Security.SslCertificateTrust CreateForX509Collection (System.Security.Cryptography.X509Certificates.X509Certificate2Collection trustList, bool sendTrustInHandshake = false);
public static System.Net.Security.SslCertificateTrust CreateForX509Collection (System.Security.Cryptography.X509Certificates.X509Certificate2Collection trustList, bool sendTrustInHandshake = false);
[<System.Runtime.Versioning.UnsupportedOSPlatform("windows")>]
static member CreateForX509Collection : System.Security.Cryptography.X509Certificates.X509Certificate2Collection * bool -> System.Net.Security.SslCertificateTrust
static member CreateForX509Collection : System.Security.Cryptography.X509Certificates.X509Certificate2Collection * bool -> System.Net.Security.SslCertificateTrust
Public Shared Function CreateForX509Collection (trustList As X509Certificate2Collection, Optional sendTrustInHandshake As Boolean = false) As SslCertificateTrust

参数

trustList
X509Certificate2Collection

包含受信任证书的集合。

sendTrustInHandshake
Boolean

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

返回

表示信任策略。

属性

例外

sendTrustInHandshaketrue ,并且当前平台不支持在握手中发送受信任的颁发者列表。

注解

sendTrustInHandshake如果参数为 true,则客户端可以使用服务器中的受信任证书颁发机构列表来选择合适的客户端证书。 在 SslCertificaetTrust.CreateForX509Collection .NET 6 中使用 创建的实例不支持SslCertificateTrust发送受信任的颁发者列表。

自 .NET 7 起,Linux 和 OSX 平台支持发送受信任的颁发者列表。

警告

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

适用于