Skip to main content
Associate II
November 26, 2025
Solved

How to get LTK

  • November 26, 2025
  • 1 reply
  • 132 views

Hello community, 
I am currently considering capturing and analyzing BLE packets by using BLE sniffer, but for that I need the LTK used for decryption.BLE Secure Connection pairing does not directly exchange LTK, so I do not know where to find it exactly in BLE Stack.

Could you please tell me how to output an LTK log by modifying the user source code?
-------------------------------------------------------------------------------------------------------------------

[Srouce]

STM32CubeWBA/Projects/NUCLEO-WBA55CG/Applications/BLE/BLE_SerialCom_Peripheral at main · STMicroelectronics/STM32CubeWBA

 

Best answer by CorentinS

Hello,

You can use debug keys that are known by sniffer tools. For that, you can add at the end of Ble_Hci_Gap_Gatt_Init() function:

uint8_t a_sc_key_type[1];
a_sc_key_type[0] = 1;
aci_hal_write_config_data(CONFIG_DATA_SC_KEY_TYPE_OFFSET,1,a_sc_key_type);

Best Regards,

Corentin

1 reply

CorentinSBest answer
ST Employee
November 27, 2025

Hello,

You can use debug keys that are known by sniffer tools. For that, you can add at the end of Ble_Hci_Gap_Gatt_Init() function:

uint8_t a_sc_key_type[1];
a_sc_key_type[0] = 1;
aci_hal_write_config_data(CONFIG_DATA_SC_KEY_TYPE_OFFSET,1,a_sc_key_type);

Best Regards,

Corentin