This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

credential keys existence check

Hello,

One of the devices I have could not connect to AWS cloud. While checking if the credentials exist, I got the following error :

NRF_KEY_MGMT_CRED_TYPE_CA_CHAIN err: 2
NRF_KEY_MGMT_CRED_TYPE_PRIVATE_CERT err: 105
NRF_KEY_MGMT_CRED_TYPE_PUBLIC_CERT err: 105

the code running:

287 static void nct_check_keys()
288 {
289 bool exists;
290 uint8_t flags;
291 int err;
292 
293 if (err = nrf_inbuilt_key_exists(CONFIG_NRF_CLOUD_SEC_TAG, NRF_KEY_MGMT_CRED_TYPE_CA_CHAIN, &exists, &flags)) 
294 printk("NRF_KEY_MGMT_CRED_TYPE_CA_CHAIN err: %d\n", err);
295 else 
296 printk("NRF_KEY_MGMT_CRED_TYPE_CA_CHAIN exists bool = %s\n", exists ? "true" : "false");
297 
298 if (err = nrf_inbuilt_key_exists(CONFIG_NRF_CLOUD_SEC_TAG, NRF_KEY_MGMT_CRED_TYPE_PRIVATE_CERT, &exists, &flags))
299 printk("NRF_KEY_MGMT_CRED_TYPE_PRIVATE_CERT err: %d\n", err);
300 else
301 printk("NRF_KEY_MGMT_CRED_TYPE_PRIVATE_CERT exists bool = %s\n", exists ? "true" : "false");
302 
303 if (err = nrf_inbuilt_key_exists(CONFIG_NRF_CLOUD_SEC_TAG, NRF_KEY_MGMT_CRED_TYPE_PUBLIC_CERT, &exists, &flags))
304 printk("NRF_KEY_MGMT_CRED_TYPE_PUBLIC_CERT err: %d\n", err);
305 else
306 printk("NRF_KEY_MGMT_CRED_TYPE_PUBLIC_CERT exists bool = %s\n", exists ? "true" : "false");
307 }

I am not sure if I  understand why i get these errors.
error 2 is for "NRF_ENOENT If there was no credential associated with the sec_tag and cred_type."
error 105 is for "NRF_ENOBUFS If the operation could not be performed because it could not allocate enough intermediate buffers to perform the operation."
why is error 2 even an error? i thought that if the credential doesn't exist it should return FALSE.
error 105 is also strange because there is no reason I would have insufficient memory.
could it be that both of these errors are just because the keys just aren't written / corrupt?

Thanks and BR,

Moshe

Parents Reply Children
No Data
Related