Looks like SSL/TLS support has recently been added to Dart via the SecureSocket class, which is great.
So, for example this
SecureSocket.connect(_host, _port).then(
(Socket socket) {
...
opens a socket with TLS enabled right away. However, what I'd like to do is open a regular (not secure) socket, send and receive some unencrypted data first, and enable TLS on it later.
Here's how it can be done in PHP:
$socket = fsockopen($server, $port, $errno, $errstr);
// ... do some unencrypted stuff...
stream_socket_enable_crypto($socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
Any way to do this in Dart?
EDIT: I guess what I'm looking for is a Dart implementation of STARTTLS.