Hi,… I have been trying to understand the dtls_sock api and i want to use ecc keys for credentials.In the following section, credential0 and credetintial1 refers to credentials after enabling CONFIG_DTLS_ECC in DTLS-SOCK example.
a.) In the DTLS sock API Documentaion in Adding credentials section,I could see that ecc_credential contains key pair of server as well as public key of the client in .client_keys . So the credman_credential_t ecc_credential contains public keys if both server and client .
b.) But in the DTLS Sock example,client uses credman_credential_t credential0 and server uses credman_credential_t credential1 . For eg, credential1 in server code contains key pair of the server and the same public key of server is again stored in client_key.Similarly in client code, credential0 contains key pair of client and client_key contains public key of the client itself.
Could someone please explain why there is this difference in storing credentials in documentation and example ?
As per my understanding(please correct if I am wrong),after the dtls handshake,public keys are exchanged between peers.I could see the key exchange after enabling CONFIG_DTLS_DEBUG.So do we even need to store/hardcode client_key (public key of the other peer) in the credman_credential_t structure in code ?