Secure Storage le_secStore_Read Issue

Hi,
I am using secure storage api in my application for storing user id and password. Using “le_secStore_Write” api I am able to write data but not able to read using “le_secStore_Read” api because of below exception
"has exited due to signal 11 (Segmentation fault)"

Any clue how to solve this issue.

Thanks

That is even more secure than intended! :stuck_out_tongue:

Can you paste the snippet of code you are using to read the secure storage? I will review it for potential problems.

1 Like

Hi David,
yes you are right!!! :smile:

here is the snap of my testing code

in adef i have:

bindings:
{
SecureStorageApp.SecureStorageApp.le_secStore -> secStore.le_secStore
}

in SecureStorageApp.c file i have

COMPONENT_INIT
{
const uint8_t store_buff[]=“1234567890”;
uint8_t mybuf[10]={0};
const char l_userId[] = “myid”;
size_t mybuff_size=sizeof(store_buff);
le_secStore_ConnectService();

if (le_secStore_Write (l_userId, store_buff, size_me)==LE_OK)
LE_INFO(“Write Success”);
else
LE_INFO(“Write Fail”);

if(le_secStore_Read (l_userId, mybuf, (size_t *)size_me)==LE_OK)
LE_INFO(“Read Success”);
else
LE_INFO(“Read Fail”);
}

Thanks

I spotted the problem. The issue is that store_buff is 10 characters plus a null terminator (so 11 bytes) while mybuf is only allocated as 10 bytes. So the problem is that you can’t read an 11 byte value into a 10 byte buffer.

Hi David,
after correction still I am getting same issue " has exited due to signal 11 (Segmentation fault)."
same issue if I Increased the buffer size more than the actual content size also. Do you have any working example on this?

Thanks

I just pushed an example to github that I wrote yesterday to make sure that SecureStorage was working for me.