1.. _bluetooth_encrypted_advertising_sample: 2 3Bluetooth: Encrypted Advertising 4################################ 5 6Overview 7******** 8 9This sample demonstrates the use of the encrypted advertising feature, such as: 10 11 - the exchange of the session key and the initialization vector using the Key 12 Material characteristic, 13 - the encryption of advertising payloads, 14 - the decryption of those advertising payloads, 15 - and the update of the Randomizer field whenever the RPA is changed. 16 17To use the `bt_ead_encrypt` and `bt_ead_decrypt` functions, you must enable 18the Kconfig symbol :kconfig:option:`CONFIG_BT_EAD`. 19 20While this sample uses extended advertising, it is **not** mandatory when using 21the encrypted advertising. The feature can be used with legacy advertising as 22well. 23 24Requirements 25************ 26 27* Two boards with Bluetooth Low Energy support 28* Two boards with a push button connected via a GPIO pin, see :ref:`Button 29 sample <button-sample>` for more details 30 31Building and Running 32******************** 33 34This sample can be found under 35:zephyr_file:`samples/bluetooth/encrypted_advertising` in the Zephyr tree. 36 37See :ref:`bluetooth samples section <bluetooth-samples>` for details. 38 39This sample uses two applications, so two devices need to be setup. 40Flash one device with the central application, and another device with the 41peripheral application. 42 43The two devices should automatically connect if they are close enough. 44 45After the boards are connected, you will be asked to press the configured push 46button on both boards to confirm the pairing request. 47 48Here are the outputs you should get by default: 49 50Peripheral: 51 52.. code-block:: console 53 54 *** Booting Zephyr OS build zephyr-v3.3.0-1872-g6fac3c7581dc *** 55 <inf> ead_peripheral_sample: Advertising data size: 64 56 Passkey for 46:04:2E:6F:80:12 (random): 059306 57 Confirm passkey by pressing button at gpio@50000000 pin 11... 58 Passkey confirmed. 59 <inf> ead_peripheral_sample: Advertising data size: 64 60 61 62Central: 63 64.. code-block:: console 65 66 *** Booting Zephyr OS build zephyr-v3.3.0-1872-g6fac3c7581dc *** 67 Passkey for 6C:7F:67:C2:8B:29 (random): 059306 68 Confirm passkey by pressing button at gpio@50000000 pin 11... 69 Passkey confirmed. 70 <inf> ead_central_sample: Received data size: 64 71 <inf> ead_central_sample: len : 10 72 <inf> ead_central_sample: type: 0x09 73 <inf> ead_central_sample: data: 74 45 41 44 20 53 61 6d 70 6c 65 |EAD Samp le 75 <inf> ead_central_sample: len : 8 76 <inf> ead_central_sample: type: 0xff 77 <inf> ead_central_sample: data: 78 05 f1 5a 65 70 68 79 72 |..Zephyr 79 <inf> ead_central_sample: len : 7 80 <inf> ead_central_sample: type: 0xff 81 <inf> ead_central_sample: data: 82 05 f1 49 d2 f4 55 76 |..I..Uv 83 <inf> ead_central_sample: len : 4 84 <inf> ead_central_sample: type: 0xff 85 <inf> ead_central_sample: data: 86 05 f1 c1 25 |...% 87 <inf> ead_central_sample: len : 3 88 <inf> ead_central_sample: type: 0xff 89 <inf> ead_central_sample: data: 90 05 f1 17 |... 91