Implement switching connection to TLS after connection established
opened this issue · comments
Currently the socket
component only allows enabling TLS for a stream through using SecureConnector
, that means a stream can not be switched to encryption after it has been created as "plaintext connection". Instead one would have to use the internal class StreamEncryption
directly, which is discouraged.
Would you be open for a PR which refactors the SecureConnector::connect
method into two parts (one using a connector to connect and one to enable encryption on a connection)?
Additionally I'd like to propose to add an "official" method to the Connection
/ConnectionInterface
to get the underlying stream, so that not only the provided class Connection
can be used to enable encryption through the means of StreamEncryption
/SecureConnector
.
Currently only classes extending (or being) the Connection
class can be used, due to the property stream
being used, which may not be exposed like that on any custom ConnectionInterface
implementations.
It would make more sense to support all classes which implement the ConnectionInterface
, so that also custom connectors and connections can be supported.
@CharlotteDunois Yes, please! 👍
It looks like this might be a duplicate of #89, so I'll close this one to help focus the discussion. Your input is very much appreciated, please make sure to post to this issue 👍