I have a device (based on tinydtls) and a server with a preloaded psk identity.
In my use case, the connection could be initiated by the server or by the device.
I did some tests where the server initiate connection to the device with the same psk key but with a different identity, and this works without any error or warning.
(at TLS level my device is considered as the server :p)
I look at the specification and it say :
If the server does not recognize the PSK identity, it MAY respond
with an "unknown_psk_identity" alert message. Alternatively, if the
server wishes to hide the fact that the PSK identity was not known,
it MAY continue the protocol as if the PSK identity existed but the
key was incorrect: that is, respond with a "decrypt_error" alert.
I see two issues here: First, the function get_psk_info() in the example application returns the wrong value in this case. This is fixed in commit 7c1852df.
The second issue is that the client application is not notified of the failed connection attempt. I understand that bug #4 "raise event for connection failed instead of return error in handle_message" already addresses this, hence I close this ticket as fixed.
Ok, I just see that the psk identify check should be done in get_psk_info.
Thx.