-
Notifications
You must be signed in to change notification settings - Fork 860
Milestone
Description
The issue
Once the certificate has been accessed on an SslStream it will no longer dispose it when the stream is disposed. A bit of a hidden requirement is that the caller takes that responsibility once it is no longer needed.
https://learn.microsoft.com/en-us/dotnet/api/system.net.security.sslstream.remotecertificate?view=net-9.0#remarks
https://github.com/npgsql/npgsql/blob/main/src/Npgsql/Internal/NpgsqlConnector.Auth.cs#L193
Not sure if this causes any actual issues. Just noticed it in the code.
It also likely (always?) returns a X509Certificate2 instance so there may be no need to create a new one on line 199.