AVSystem / Anjay

C implementation of the client-side OMA LwM2M protocol
Other
188 stars 68 forks source link

handshake failed with Orange Live Objects #63

Closed SebDominguez closed 1 year ago

SebDominguez commented 1 year ago

Tying to run Anjay-freertos-client-B-L462E-CELL1-TYPE1SC.bin with Orange Live Objects but I keep getting handshake failed: -26624

I can see on my Orange Live Objects dashboard a Handshake Client Key Exchange event:

Capture d’écran 2023-06-08 à 13 48 25

I'm out of idea to make this working.

Here's a complete trace from my B-L462E-CELL1 board:

===== X-Cube-Cellular version : X-CUBE-CELLULAR-7.0.0 =====

TYPE1SC UART config: BaudRate=115200 / HW flow ctrl=1

INFO [anjay] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_core.c:417]: Initializing Anjay ##version##

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /0

INFO [security] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/modules/security/anjay_mod_security.c:392]: Added instance 0 (SSID: 1, URI: coaps://lwm2m.liveobjects.orange-business.com:5684)

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /1

INFO [server] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/modules/server/anjay_mod_server.c:279]: Added instance 0 (SSID: 1)

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /3

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /3303

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /3304

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /3315

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /3313

INFO [anjay_dm] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/anjay_dm_core.c:159]: successfully registered object /3314

INFO [gyrometer_driver] [/home/soutys/work/clients/anjay-freertos-client/Projects/B-L462E-CELL1/UserApp/app_compat/gyrometer_driver.c:13]: Gyrometer not supported

INFO [app] [/home/soutys/work/clients/anjay-freertos-client/Application/Src/lwm2m.c:75]: cellular configuration is updated

Modem Boot OK, sim slot nb 0

Modem Boot OK, sim slot nb 0

INFO [app] [/home/soutys/work/clients/anjay-freertos-client/Application/Src/lwm2m.c:75]: cellular configuration is updated

INFO [app] [/home/soutys/work/clients/anjay-freertos-client/Application/Src/lwm2m.c:75]: cellular configuration is updated

Modem Boot OK, sim slot nb 1

Modem Boot OK, sim slot nb 1

INFO [app] [/home/soutys/work/clients/anjay-freertos-client/Application/Src/lwm2m.c:75]: cellular configuration is updated

Network is up with IP 10.138.233.100

INFO [app] [/home/soutys/work/clients/anjay-freertos-client/Application/Src/lwm2m.c:63]: network is up

INFO [anjay] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_reload.c:148]: servers reloaded

INFO [anjay] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connections.c:850]: server /0/0: transport change: (none) -> U (uri: coaps://lwm2m.liveobjects.orange-business.com:5684)

WARNING [avs_net] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/deps/avs_commons/src/net/mbedtls/avs_mbedtls_socket.c:1172]: Could not restore session; performing full handshake

ERROR [avs_net] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/deps/avs_commons/src/net/mbedtls/avs_mbedtls_socket.c:1296]: handshake failed: -26624

ERROR [anjay] [/home/soutys/work/clients/anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connection_ip.c:122]: could not connect to lwm2m.liveobjects.orange-business.com:5684
SebDominguez commented 1 year ago

Alright the solution was to configure the PSK on the client in plain ASCII and the PSK on the server in HEX.

For instance: 4d795374726f6e6750617373776f7264 on the Orange Live Objects config and MyStrongPasswordon the Anjay config.

That's definitely a gotcha for newbies...

Kucmasz commented 1 year ago

Hi!

Good to hear that you have managed to overcome this problem. This actually sounds like something that Orange Live Objects Server provider should warn about, although I am not familiar with this environment. In Coiote LwM2M Server which is developed and maintained by AVSystem, there is a possibility to set and view PSK in both plaintext and hex format. Anjay does provide OMA LwM2M Specification conformance and thus interoperability with any LwM2M Server that is the protocol specification compliant as well, but our tutorials and demos are based on communication with Coiote Server as that's our ecosystem and there we are able to provide support on both ends.

If you have any other troubles or concerns, don't hesitate to reach us.

Regards, Tomasz

SebDominguez commented 1 year ago

Thank you very much for your reply Tomasz. Do you have a dedicated channel for support? Some of my problems aren't related to the Anjay OMA LwM2M implementation and filling an issue for those seems to be off-topic in this GitHub issues tracker.

Kucmasz commented 1 year ago

You can join our Discord server where we have different rooms for discussions regarding specific SW and HW platforms as well as some cloud-related ones. If you have any questions, feel free to join and talk there!