Esp32 + Arduino libs + PlatformIO + flash encryption

Hi,

I have been starting to work on my new esp32 project.
I use PlatformIO and Arduino libraries.

A the end of the project I would like to make impossible to read program from the esp.

I was reading a lot about this and I’m confused.

I can summarize my doubts into below questions:

  1. What configuration (I don’t need Arduino framework - raw c++ would be better) should I use?

  2. How to add Arduino libraries to non Arduino platform Io project

  3. How can I encrypt my code when I want to use esp-idf with the Arduino libs

  4. Assuming that encrypting will finish with the success can I still use PlatformIO for the deployment?

Sorry for stupid question, but I’m new in esp/Arduino environment.
My goal is just to make my code safe from read and I want to use Arduino libraries for the external sensors etc.

Could you advise?

Thanks!