The FixedSslStream class is an SslStream that properly sends a close_notify message when closing the connection. This is required per RFC 5246 to avoid truncation attacks.
The SslStream included in .NET 4 does not adhere to this requirement. Somewhat surprisingly, it was decided by Microsoft to not fix the security problem, citing backwards compatibility as the reason. (Further reading)
This library is licensed under LGPLv3.
The original code was written by user Neco on Stackoverflow. Many thanks to them!
I slightly refactored the code and included changes that help improve interaction in more complex environments.