Hi,
I am working with the ECDH using the example project of Demo_examples of Demoapp_sessionkeys as reference. I am able to generate the ECC pair keys, import the peer public key and generate the common shared key which are stored in GET_KEY_HANDLE(HSE_KEY_CATALOG_ID_RAM, 0, 0) for ECC pair keys;
GET_KEY_HANDLE(HSE_KEY_CATALOG_ID_RAM, 1, 0) for Peer Public Key and
GET_KEY_HANDLE(HSE_KEY_CATALOG_ID_RAM, 2, 0) for DH shared key. So I assigned the same as srcKeyHandle paramter in the derivekey function with the same DH shared key slot and new slot for the target key. But i get invalid params. I did not clearly understand about the keyderive even after going through reference manual. Please find the attached snippets. And also is it needed to import the derived key?
Thanks for the support.
Solved! Go to Solution.
Hi @kerti1
I can see that you configured targetKeyHandle as HSE_KEY_TYPE_AES. However, it should be HSE_ KEY_ TYPE_ SHARED_ SECRET. Here is a screenshot from the HSE Service API reference manual:
So, the result of this operation is another shared secret. If you need AES key, you need to extract such key using mentioned hseKeyDeriveCopyKeySrv_t service as shown in the demo example. Derived key is stored directly to slot defined by keyhandle, you are not supposed to import it manually by yourself.
Regards,
Lukas
Hi @kerti1
I can see that you configured targetKeyHandle as HSE_KEY_TYPE_AES. However, it should be HSE_ KEY_ TYPE_ SHARED_ SECRET. Here is a screenshot from the HSE Service API reference manual:
So, the result of this operation is another shared secret. If you need AES key, you need to extract such key using mentioned hseKeyDeriveCopyKeySrv_t service as shown in the demo example. Derived key is stored directly to slot defined by keyhandle, you are not supposed to import it manually by yourself.
Regards,
Lukas
Hi @lukaszadrapa ,
Thanks for the solution. But I already have defined {HSE_ALL_MU_MASK, HSE_KEY_OWNER_ANY, HSE_KEY_TYPE_SHARED_SECRET, 2U, HSE_KEY638_BITS} 2 keys slots i thought it would be okay for derived key.
And also we should import our public key in order to share to the peer persons. But the key generated is changing every time when I run the program i think it is because of RAM keys. If i want to have constant key. I hope using NVM keys is sufficient. Sorry for asking basic questions. But I lack clarity in these topics.