-
Notifications
You must be signed in to change notification settings - Fork 218
Using DTLS, with UDP, and generalized packet objects #188
Comments
Do you mean on the C or Python side? On the C side you just make an mp_stream_p_t struct for your type. But I guess you are asking about how to do that on the Python side. In that case you may want to look at micropython/micropython#3034 which adds an io.IOBase class for this purpose. |
Yes, this is exactly what I had in mind. Since |
Ok. That IOBase class allows you to implement read/write on the Python side, but not ioctl (but not hard to add the latter). |
Also, I should mention, I have DTLS working for plain-vanilla UDP sockets, with the exception that hello verify cookies aren't working for me. Implementation is somewhat involved -- there are a lot of things that have to be just right. But that's the nature of socket programming. C code changes:
Python code requirements:
|
Yeah, that's something I was considering implementing (though I'd have to ask you how to do it!), for this use-case. And, yes, I'd need Is that going to be merged? It's worth noting that this is only to support my end goal of robust encryption over LoRa. I'm not even sure if it will work properly given the max LoRa payload size, and other factors (such as filtering on client MAC, etc). But I figure if it can be made to work for UDP (as intended), then there's a good shot at using that as a stepping stone to other transports. |
Hmmm, this is also interesting to me as I'm looking at ESP-Now which passes small messages around in an ad-hoc manner (see #176) It has a send method and a recv callback and I'd like to expose that as a generic datagram transport. |
I haven't abandoned this. I'm juggling several work projects right now. This is required for one of them, and I'll revisit when I'm working again on that project. |
Curious if you made any progress. I'm doing some similar work on the ESP8266 mbedtls DTLS and hitting handshake problems |
End Goal
Using DTLS for LoRa data. Why? Because I'm using the RFM95 (sx1276) module that doesn't appear to have encryption, and the RFM69 (sx1231)modules (that do have encryption) are using AES ECB, which is bad for the highly repetitive nature of my packets.
Intermediate Goal
Enable DTLS for ordinary UDP sockets, using mbedtls, which is already used in
ussl
.Doing this for UDP sockets seems relatively straight-forward, as all µPy sockets implement an underlying "stream" protocol, thus the
ussl
module will work, with some modification.It would be nice if there were a generic µPy "stream" protocol class that could be subclassed (to talk to LoRa, which is very UDP-like), and handed directly to (modified for DTLS)
ussl
for wrapping -- or is there already?The text was updated successfully, but these errors were encountered: