Add TLS/SSL support #342
Labels
Priority: Medium
This issue may be useful, and needs some attention.
Status: Accepted
It's clear what the subject of the issue is about, and what the resolution should be.
Type: Enhancement
Most issues will probably ask for additions or changes.
Is your feature request related to a problem? Please describe.
The TCP component is incapable of connecting over TLS/SSL (ex. to any HTTPS site)
Describe the solution you'd like
The simplest solution would be to add a flag to
Psl\TCP\Connect
which would set the protocol totls
(tls requested) ortcp
(default/no tls requested) here:psl/src/Psl/TCP/connect.php
Line 32 in 9f9ddfe
Describe alternatives you've considered
https://www.php.net/manual/en/function.stream-socket-enable-crypto.php appears to allow you to enable TLS after starting a stream, however I was not able to get it to work with HTTPS, so it looks like there's a slightly different effect of
stream_context_create("tls://")
vs$stream = stream_context_create("tcp://"); stream_socket_enable_crypto($stream);
- this would allow you to do something like$stream->enableCrypto();
.Additional context
Running a TLS server is an entirely different beast, because that is going to require loading the certificate in (client certificates also exist but they're far less used 😢). With the complexity here it might make sense to make an entirely separate TLS-over-TCP module.
The text was updated successfully, but these errors were encountered: