Issue with KeyDerivation

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Issue with KeyDerivation

ソリューションへジャンプ
604件の閲覧回数
kerti1
Contributor III

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?

 

KeerthiT_0-1748270110090.png

KeerthiT_1-1748270599226.png

Thanks for the support.

タグ(1)
0 件の賞賛
返信
1 解決策
577件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

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:

lukaszadrapa_0-1748343704597.png


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

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
578件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

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:

lukaszadrapa_0-1748343704597.png


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

0 件の賞賛
返信
571件の閲覧回数
kerti1
Contributor III

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. 

 

0 件の賞賛
返信