SslCertificateTrust.CreateForX509Store(X509Store, Boolean) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會產生一個新的 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 不要寄清單。
傳回
代表一種信任政策。
例外狀況
sendTrustInHandshake 是 true,且目前平台不支援以握手方式傳送受信任發行者名單,或者(Windows 上)store 的位置不是 LocalMachine。
備註
若參數 sendTrustInHandshake 為 true,客戶端可利用伺服器提供的受信任憑證授權中心清單來選擇合適的客戶端憑證。 在.NET 6中,清單只在Windows上傳送,且取決於「HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\SendTrustedIssuerList」登錄檔設定是否設為1。 自 .NET 7 起,該列表也在 Linux 和 OSX 平台上傳送。
警告
受信任的 CA 清單會增加握手訊息的大小。 這也可以被視為系統配置的資訊洩漏。 基於這些原因,我們建議將 設定 sendTrustInHandshake 為 false。