<div dir="ltr"><div style="font-size:12.8px">Hi</div><div style="font-size:12.8px"><br></div><span style="font-size:12.8px">Is there a way to downgrade a TLS connection to TCP without an TLS Alert exchange in Erlang/Elixir?</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">To give a bit of context: We've implemented the MS-TDS protocol (used by Microsoft SQL Server) using Elixir and the ssl and gen_tcp libraries. A TDS connection typically is unencrypted apart from the login. It starts unencrypted with a prelogin handshake, after that comes the TLS handshake, and encrypted login packet is sent and then all further packets are unencrypted. </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Using :ssl.close to downgrade the socket to TCP expects a TLS alert exchange to end the SSL connection however TDS does not expect or support TLS alerts, it simply goes back to being unencrypted after the login. I appreciate this is not standard TLS but I'm not expecting to change Microsoft's protocol to SQL Server any time soon! </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Currently we stop encryption by sending data directly to the TCP socket and changing the controlling process of the TCP socket to our receiving process. This works however it leaves the ssl_connection process hanging around. It monitors our receiving process and if that process dies a TLS alert is sent which TDS is not expecting. The alert is only sent in some teardown scenarios but it just seems rather messy. We're wondering if there's a better way to approach our problem?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Many thanks<br><br>Rob</div></div>