Re: [RFC idea] DTLS support in ext/openssl (Openssl\Dtls)
| From: | Gianfrancesco Aurecchia | Date: | Sun, 05 Jul 2026 10:05:30 +0000 |
| Subject: | Re: [RFC idea] DTLS support in ext/openssl (Openssl\Dtls) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131776@lists.php.net to get a copy of this message | ||
Il giorno ven 3 lug 2026 alle ore 23:51 Jakub Zelenka <bukka@php.net> ha
scritto:
>
> Just a little follow up on this. I spoke with Arnaud, who is working on IO
> hooks, and he got actually a better idea that we could allow using user
> stream wrapper as an underlaying stream which would cover this much better.
> So it could be used like this:
>
> $transport = fopen("my-dtls-transport://...");
> stream_socket_enable_crypto($transport, true,
> STREAM_CRYPTO_METHOD_DTLS_CLIENT);
> fwrite($transport, "some data");
>
> It means that for your use case, we will probably
> need stream_socket_enable_crypto. This will still need a custom BIO and
> might not be completely straight forward so not something to look now. Just
> keep that in mind.
>
>
Thanks to you and Arnaud, nice idea. Using a user stream wrapper as the
underlying transport and running DTLS on top of it via
'stream_socket_enable_crypto' (through a custom BIO) covers the case more
flexibly, leaving the application in control of the transport.
If I understand correctly: the app implements its own stream wrapper, then
'stream_socket_enable_crypto($transport, true,
STREAM_CRYPTO_METHOD_DTLS_CLIENT)' enables DTLS on top, with a custom BIO
that reads/writes through the underlying stream (instead of the datagram
BIO on the socket). Is that right?
Thanks again, I'll keep it in mind.
Kind regards,
Gianfrancesco