I am confused about protecting flash from being read. I have the bootloader from AN4379 up and working. I want to protect the flash from reading and I still need to use the backdoor key to verify the part was correctly programmed at the factory. I think I need to do the following
1. In the bootloader file Boot_loader_task.c
Set the KEYEN and SEC bits using NVOPT_INIT.
Set the NVBACKKEY to my key.
2. At this point I an not sure what I have to do. When the bootloader runs does it need to enter the key to be able load the application. Can I include the key the application? Is this the correct approach?