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

How to use MQTT+TLS in nRF9160?

I'm working on a project using nRF9160 DK.

How can you use MQTT+TLS in nRF9160?

Where should ca certificate file be stored?

I modified the code below in mqtt_simple project. What code should I modify additionaly?

Fullscreen
1
2
<prj.conf>
CONFIG_MQTT_LIB_TLS=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<main.c>
/**@brief Initialize the MQTT client structure
*/
static void client_init(struct mqtt_client *client)
{
mqtt_client_init(client);
broker_init();
/* Add from here */
static struct mqtt_utf8 password;
static struct mqtt_utf8 user_name;
password.utf8 = (u8_t *)MQTT_PASSWORD;
password.size = strlen(MQTT_PASSWORD);
user_name.utf8 = (u8_t *)MQTT_USERNAME;
user_name.size = strlen(MQTT_USERNAME);
/* to here */
/* MQTT client configuration */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX