Topics

How to use DTLS with offloaded socket if the underlying modem does not support DTLS

Holger Gräf
 

Dear all,

I have adapted the Sara R4 modem driver (zephyr/drivers/modem/ublox-sara-r4.c) in Zephyr in order to control a Quectel BC68 NB-IoT modem. The aim is to use this with Zephyr's LwM2M engine. Without DTLS everything works fine.

Now I want to add DTLS encryption to my setup, but I have not managed to figure out how to implement this with the socket offload API used by the modem driver (note that the Quectel modem I use does not itself support DTLS sockets).

Is there any easy way to implement this?

Thanks and all the best,

Holger

William Fish
 

Holger,
Great if you have created a driver...you may want to create a PR so that it gets reviewed by the Dev community The man that should be able to help is Mike Scott.

Billy..

William Fish
 

A quick internet search brought up a manual which gave a basic DLTS example:
https://www.quectel.com/UploadImage/Downlad/Quectel_BC95-G&BC68_AT_Commands_Manual_V1.1.pdf

BC95-G&BC68_AT_Commands_Manual -- Pg 122 
 
Register to Huawei’s IoT Platform with DTLS
 
AT+CGATT? //Query the PS service attach status.
+CGATT:1 //Attached to the PS service.
OK
 
AT+NCDP= 180.101.147.115,5684 //Set IoT platform IP address and port. The port is 5684.
OK
 
AT+QSECSWT=1 //Encryption using standard DTLS.
OK
 
AT+QSETPSK=201703230000024,0123456789ABCDEF0123456789ABCDEF
OK //Set PSK ID and PSK.
 
AT+QREGSWT? //Query the registration mode.
+QREGSWT:0 //Manual registration mode.
OK
 
AT+QLWSREGIND=0 //Start to register to the IoT platform.
OK
 
+QLWEVTIND:0 //Successful registration indication.

Holger Gräf
 

Hi Billy,

thanks for the reply. I still have to clean up the driver a bit, then I will create the PR.

With regard to the second message, thanks for the hint. I have already stumbled upon these commands, but according to the manual they are specific to Huawei's IoT platform, which I don't use. I have the impression that it's based on LwM2M, but I would like to be able to use DTLS encryption regardless of the protocol I use (UDP, TCP or the higher level COAPS or LwM2M).

That's why I'm looking for a way to use Zephyr's mbedtls with my offloaded sockets. Any help would be very much appreciated :-)

All the best,

Holger

Jukka Rissanen
 

Hi Holger,

one option is use the generic GSM modem, which uses PPP to connect to
modem, instead of offloading the IP stack to the modem. In that case
one can send DTLS data via the modem. Unfortunately the modem you
mentioned (Quectel BC68) does not seem to support PPP mode.

Cheers,
Jukka

On Wed, 2020-02-26 at 02:04 -0800, Holger Gräf wrote:
Hi Billy,

thanks for the reply. I still have to clean up the driver a bit, then
I will create the PR.

With regard to the second message, thanks for the hint. I have
already stumbled upon these commands, but according to the manual
they are specific to Huawei's IoT platform, which I don't use. I have
the impression that it's based on LwM2M, but I would like to be able
to use DTLS encryption regardless of the protocol I use (UDP, TCP or
the higher level COAPS or LwM2M).

That's why I'm looking for a way to use Zephyr's mbedtls with my
offloaded sockets. Any help would be very much appreciated :-)

All the best,

Holger