SqlConnectionStringBuilder.ServerCertificate Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the path to a certificate file to match against the SQL Server TLS/SSL certificate for the connection. The accepted certificate formats are PEM, DER, and CER. If specified, the SQL Server certificate is checked by verifying if the ServerCertificate provided is an exact match. (Only available in v5.1+)
public:
property System::String ^ ServerCertificate { System::String ^ get(); void set(System::String ^ value); };
public string ServerCertificate { get; set; }
member this.ServerCertificate : string with get, set
Public Property ServerCertificate As String
Property Value
The value of the ServerCertificate property, or string.Empty if none has been supplied.
Remarks
This property corresponds to the "Server Certificate" and "ServerCertificate" keys within the connection string.
Note
When ServerCertificate is specified, the certificate presented by the server is always compared against the certificate loaded from this path, including when the presented certificate already passes chain-and-name validation. An exact match satisfies certificate validation.
If the presented certificate does not match, or the file cannot be loaded or parsed, the TLS handshake fails; a configured ServerCertificate is never silently ignored.
Certificate validation itself can be disabled by TrustServerCertificate=true (except with Encrypt=strict, where validation is always performed). When validation is disabled, ServerCertificate is not consulted.