| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Encryption negotiation
This information applies to the following SoftDevices: S212, S332

The ANT encryption negotiation module provides functions that can be used by the slave node to negotiate encryption parameters with an encrypted ANT master channel and to use the cryptographic functionality that is provided by the ANT stack.

Encryption negotiation starts after the slave has connected to an encrypted master channel. The negotiation is event-driven. Therefore, it requires full attention from the application.

This module should be used as extension to the Encryption configuration module. The API for the module is available here: ANT encryption configuration

See ANT Message Protocol and Usage for detailed information about ANT's encryption capabilities.

The following steps are required to use this module:

1. Declare the macro ANT_ENCRYPT_SLAVE_NEGOTIATION_USED globally in the project, so that the module is automatically initialized when you configure the Cryptographic settings of the ANT stack.
2. In the application, include the ANT encryption event handler ant_encrypt_event_handler in the ANT event dispatching process, so that it is called every time an ANT event occurs. Optionally, you can implement an application-specific event handler of type ant_encryp_user_handler_t that deals with encryption events like negotiation success, negotiation failure, or channel loss. Call ant_enc_event_handler_register to register this event handler.
3. When initializing the slave channel, make sure to configure the encryption settings. See Channel initialization.
4. Use ant_enc_event_handler_register to register an event handler for encryption events to react to changes in the encryption state of the channel.

To quickly get started, use the sample code from the ANT Encrypted Channels Receiver example.