This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to determine if LE link is encrypted?

How can one determine if the link is encrypted?  Can that be done by  searching the device info entry for the connect BD ADDR and then checking the device info flag for  DEVICE_INFO_FLAGS_LTK_VALID?  This would also require that the device security information is saved in the slave as well as the master.

-Raydaniel Trujillo

 

  • Raydaniel,


    There is a GAP API (GAP_LE_Query_Encryption_Mode()) that allows the encryption state of the link to be determined.  A code snippet below to determine the link state is shown below where ConnectionBD_ADDR is the BD_ADDR of the device that you are connected to.

    GAP_Encryption_Mode_t                         GAPEncryptionMode;
    if((GAP_LE_Query_Encryption_Mode(BluetoothStackID,ConnectionBD_ADDR, &GAPEncryptionMode) == 0) && (GAPEncryptionMode == emEnabled))
    {
    //xxx Link is encrypted
    }




**Attention** This is a public forum