Skip to content

Expose connection encryption information to clients #2353

@shueybubbles

Description

@shueybubbles

Is your feature request related to a problem? Please describe.

For SSMS we want to give the user full details about their connection security, including encryption status, certificate details, and TLS protocol version.
Such information is needed for both failed and successful connections. For failed connections we want to show the cert validation errors along with the public key cert information so the user can make an informed choice about whether to set Trust Server Certificate or Host Name In Certificate in their connection dialog.

Describe the solution you'd like

  • Provide a more detailed data structure in SqlException that contains the certificate information when cert validation fails
  • Expose TLS and cert information on SqlConnection objects that are in the Open state.
  • Consider exposing cert validation callbacks like you do for token acquisition so apps can have more fine grained control.

It'd be great if this functionality enables an app like SSMS to install the server cert locally to automate the client config steps documented at https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/special-cases-for-encrypting-connections-sql-server?view=sql-server-ver16

Describe alternatives you've considered

We could try to negotiate a TLS connection to the server out-of-band from the SQL connection to get the cert and do our own validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement 💡Issues that are feature requests for the drivers we maintain.Public API 🆕Issues/PRs that introduce new APIs to the driver.

    Projects

    Status

    Ideas for Future

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions