[PHP-DEV] Re: [RFC idea] DTLS support in ext/openssl (Openssl\Dtls)
[email protected] (Gianfrancesco Aurecchia) Sun, 5 Jul 2026 12:05:30 +0200
| Newsgroups | php.internals |
|---|---|
| Message-ID | <CAP=-gUtwmCdeGzzjm50NN8z-DNf-RNi8fGhWXFexPjk-GuNPQg@mail.gmail.com> |
Il giorno ven 3 lug 2026 alle ore 23:51 Jakub Zelenka <[email protected]> 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