Hello,
I am using MCAL Csec driver which is received by NXP.
I have done the program partition and I am able to write Master key and keys(for e.g. KEY_2) using Csec APIs commands successfully but when I try to execute Csec_EncryptEcb(CSEC_KEY_2, aPlainText_Enc, 16U, aCipherText_Enc); then I am getting ERC_KEY_INVLAID.
aPlainText_Enc and aCipherText_Enc is array of 16 bytes
Can you please help what is the root cause here as I have taken care counter value(i.e set to 1 while writing first time) and flags (set to 1 i.e. only wild card is enable) while writing keys
BR,
Pravin
Solved! Go to Solution.
Hello,
Please verify that your flag attributes were set correctly. Probably the bit was written to the KEY_USAGE flag instead of the WILDCARD field.
You can try this way: write another key value with flag = 0 in all fields and different counter to a key, then use that key to encrypt. If it can be performed, then probably the key attributes were set incorrectly with previous key value.
Best Regards,
Nam
Hello,
Please verify that your flag attributes were set correctly. Probably the bit was written to the KEY_USAGE flag instead of the WILDCARD field.
You can try this way: write another key value with flag = 0 in all fields and different counter to a key, then use that key to encrypt. If it can be performed, then probably the key attributes were set incorrectly with previous key value.
Best Regards,
Nam