This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

AES ENCRYPTATION with sd_ecb_block_encrypt in nRF51822 BLUETOOTH SMART BEACON KIT

Hello,

I am trying to ecrypt some data in order to send some data encrypted in the MINOR and MAJOR adverts of the device. I used this code to ecrypt the data ( this is an example):

nrf_ecb_hal_data_t *aestructura; *(*aestructura).key=0x12; *(aestructura).cleartext=16; //Aplicacion de AES sd_ecb_block_encrypt(aestructura); encriptado=(*aestructura).ciphertext;

And I want to send this data:

memcpy(tmp.data.beacon_uuid, &clbeacon_info[2], 16); tmp.data.major_value[0] = clbeacon_info[18] = 0x00; tmp.data.major_value[1] = clbeacon_info[19] = 0x01; tmp.data.minor_value[0] = clbeacon_info[20] = 0x00; tmp.data.minor_value[1] = clbeacon_info[21] = encriptado; tmp.data.measured_rssi = clbeacon_info[22] = APP_MEASURED_RSSI;

I upload the app to the device and works well but the Minor is always 0, so it doesn't ecrypt well. Why am I doing wrong?

Is there any solution?

Regards.

Iván

Related