Hi @xiaoweix
It’s up to user to track the keys. There’s no flag which would inform you if a key is loaded or not. And because Memory Update Protocol must be followed to import or update a key, it not possible to “load a key again”. There’s a counter for each key which must be incremented if you want to update a key.
If you try to load the same key again (I mean with the same counter, so M1-M3 values are the same) then the key update won’t be successful and you will get error ERC_KEY_UPDATE_ERROR.
There’s one workaround to check if a key slot is still empty or if it is already loaded. You can try to perform some operation (like encryption, decryption, CMAC generation…). If a key slot is empty, you will get ERC_KEY_EMPTY error.
Regards,
Lukas