is it possible to store a file in bundled format in one app and read the same file through another app if the apps are connected over IPC?
You can see here
I can see there is “file" type
It is not working for me
my function is mentioned in App1.c
static void ReadFileFromSecStore(const char* secStoreKey)
{
uint8_t buf\[MAX_FILE_SIZE\];
size_t len = sizeof(buf);
le_result_t res = le_secStore_Read(secStoreKey, buf, &len);
if (res == LE_OK)
{
LE_INFO("Successfully read '%s' from Secure Storage, size=%zu bytes", secStoreKey, len);
// Example: if the file is text-based (PEM / XML)
char\* text = malloc(len + 1);
if (text)
{
memcpy(text, buf, len);
text\[len\] = '\\0'; // null-terminate
LE_INFO("File contents preview: %.100s...", text); // log first 100 chars only
free(text);
}
}
else
{
LE_ERROR("Failed to read '%s' from Secure Storage (err=%d)", secStoreKey, res);
}
}
Could you tell me what will be included in my system.api so that above function can be called in another app which is connected via IPC.
I want to execute below function call from App2
COMPONENT_INIT
{
ReadFileFromSecStore("tls/attest_priv.pem");
}
Does this help to pass an array?
I included this in system.api
STRUCT ARRAY123
{
string Array1[10];
int32 port1;
string Array2[10];
int32 port2;
string Array3[10];
int32 port3;
string Array4[10];
int32 port4;
string Array5[10];
int32 port5;
};
FUNCTION arraySend
(
ARRAY123 asd IN
);
and also renamed my function in app1.c code like below but not workign for me
static void system_arraySend(const char* secStoreKey)
{
uint8_t buf\[MAX_FILE_SIZE\];
size_t len = sizeof(buf);
le_result_t res = le_secStore_Read(secStoreKey, buf, &len);
if (res == LE_OK)
{
LE_INFO("Successfully read '%s' from Secure Storage, size=%zu bytes", secStoreKey, len);
// Example: if the file is text-based (PEM / XML)
char\* text = malloc(len + 1);
if (text)
{
memcpy(text, buf, len);
text\[len\] = '\\0'; // null-terminate
LE_INFO("File contents preview: %.100s...", text); // log first 100 chars only
free(text);
}
}
else
{
LE_ERROR("Failed to read '%s' from Secure Storage (err=%d)", secStoreKey, res);
}
}
How about this for client to server communication?
How about this for server to client communication?
Btw, in you code, secStoreKey is a input, so the IPC client should first read the file content and pass it to IPC server by the function arraySend()
Or you can set it to output, so the IPC server can first read the file content and pass it to IPC client when client calls the the function arraySend()