Share embedded certificates between projects

zliudr
Posts: 360
Joined: Thu Oct 03, 2019 5:15 am

Share embedded certificates between projects

Postby zliudr » Mon Feb 03, 2020 12:57 am

I am using Make. I have several projects that share a few certificates that I want to relocate to a folder say common_files. I tried a few times to do this but couldn't get it to work, although I managed to keep common files such as code and include to work.

Currently I have in component.mk in the same folder as the main code, this line:

COMPONENT_EMBED_TXTFILES += BaltimoreCyberTrustRoot.pem

This embeds the cert so I don't have to mess with saving it to spiffs or sd card. I wonder what to do to share it with other projects.

Desired:

./common_files/
BaltimoreCyberTrustRoot.pem

./iot_project/
main.c

How do we help Make do this? Thanks.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: Share embedded certificates between projects

Postby ESP_Sprite » Mon Feb 03, 2020 8:49 am

You could make common_files into a component (by dropping a component.mk into the dir), then use EXTRA_COMPONENT_DIRS in the project makefile to refer to that path.

zliudr
Posts: 360
Joined: Thu Oct 03, 2019 5:15 am

Re: Share embedded certificates between projects

Postby zliudr » Mon Feb 03, 2020 8:31 pm

ESP_Sprite wrote:
Mon Feb 03, 2020 8:49 am
You could make common_files into a component (by dropping a component.mk into the dir), then use EXTRA_COMPONENT_DIRS in the project makefile to refer to that path.
I think I did that since I am compiling fine with all my common files in that common folder and an empty component.mk. Should I include the cert in common_files's component.mk or in my project main folder's component.mk? I tried the latter with relative path etc. and that didn't work. Make couldn't find the cert.

A better way is to turn it into a .h or .c file and change my code ;)

Who is online

Users browsing this forum: No registered users and 135 guests