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

適用於