Example #1
0
static int kaa_init_key(void)
{
    struct stat stat_result;
    int key_result = stat(KAA_KEY_STORAGE, &stat_result);

    if (!key_result) {
        bool need_dealloc = false;
        posix_binary_file_read(KAA_KEY_STORAGE, &kaa_public_key, &kaa_public_key_length, &need_dealloc);
    } else {
        kaa_generate_pub_key();
        posix_binary_file_store(KAA_KEY_STORAGE, kaa_public_key, kaa_public_key_length);
    }

    return 0;
}
void ext_configuration_store(const char *buffer, size_t buffer_size)
{
    posix_binary_file_store(KAA_CONFIGURATION_STORAGE, buffer, buffer_size);
}