SslCertificateTrust.CreateForX509Collection 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會產生一個新的 SslCertificateTrust。
public static System.Net.Security.SslCertificateTrust CreateForX509Collection(System.Security.Cryptography.X509Certificates.X509Certificate2Collection trustList, bool sendTrustInHandshake = false);
[System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
public static System.Net.Security.SslCertificateTrust CreateForX509Collection(System.Security.Cryptography.X509Certificates.X509Certificate2Collection trustList, bool sendTrustInHandshake = false);
static member CreateForX509Collection : System.Security.Cryptography.X509Certificates.X509Certificate2Collection * bool -> System.Net.Security.SslCertificateTrust
[<System.Runtime.Versioning.UnsupportedOSPlatform("windows")>]
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 不要寄清單。
傳回
代表一種信任政策。
- 屬性
例外狀況
sendTrustInHandshake 而 true 目前平台不支援以 Handshake 方式傳送受信任發行人名單。
備註
若參數 sendTrustInHandshake 為 true,客戶端可利用伺服器提供的受信任憑證授權中心清單來選擇合適的客戶端憑證。 在 .NET 6 中使用 SslCertificaetTrust.CreateForX509Collection 建立的 SslCertificateTrust 實例不支援發送受信任發行者名單。
自 .NET 7 起,Linux 與 OSX 平台支援發送受信任發行者名單。
警告
受信任的 CA 清單會增加握手訊息的大小。 這也可以被視為系統配置的資訊洩漏。 基於這些原因,我們建議將 設定 sendTrustInHandshake 為 false。