Hi,
the RAM_KEY can be exported if it was loaded as a plaintext (command CMD_EXPORT_RAM_KEY). A key loaded by the secure protocol may not be exported.
There’s a function EXPORT_RAM_KEY() in the AN5401SW zip package. You can find it in file CSEc_functions.h which is included in all projects.
From the reference manual:
“36.5.13.15 CMD_EXPORT_RAM_KEY
The Export RAM Key command exports the RAM_KEY into a format protected by the
SECRET_KEY. The key may be imported again by using the CMD_LOAD_KEY
command.
A RAM_KEY can only be exported if it was written as plain text, i.e., by
CMD_LOAD_PLAIN_KEY.”
Regarding second question, please take a look at section "4.4.4 Updating Code and resulting BOOT_MAC" in AN5401.
Regards,
Lukas