davidfowl / BedrockFramework

High performance, low level networking APIs for building custom servers and clients.
MIT License
1.07k stars 155 forks source link

StartTLS command #95

Open agnauck opened 4 years ago

agnauck commented 4 years ago

I am currently evaluating BedrockFramework for an XMPP protocol implementation. XMPP requires StartTls on the protocol level. Is there a way currently to start a TCP connection in plain and upgrade it to TLS later when StartTls gets negotiated on the protocol level?

I was studying the source codes of the TLS Middleware. My assumption is that its always securing the connection immediately when the socket connects here: https://github.com/davidfowl/BedrockFramework/blob/42704c35bee42f08ccd6b340de1d66efaec7dca0/src/Bedrock.Framework/Middleware/Tls/TlsClientConnectionMiddleware.cs#L46

Is this correct?

agnauck commented 4 years ago

anyone able to help here? Thanks

DeSebastianSimon commented 4 years ago

I did this for a proprietor protocol where the client sends a bunch of telegrams, then a request telegramm before starting the tls authentification. My solution just sits in the connection handler and isn't using the middelware though.

The way i did this was: