<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115405/issue-with-tls-on-nrf7002dk</link><description>I believe I&amp;#39;m having a similar issue to this ticket 
 I&amp;#39;m trying to connect to AWS IoT Core with an nRF7002DK by basing my work on the AWS IoT sample. I&amp;#39;m building the project for the nrf7002dk/nrf5340/cpuapp/ns target with NCS version 2.7.0. I&amp;#39;m adding</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Oct 2024 14:36:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115405/issue-with-tls-on-nrf7002dk" /><item><title>RE: Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/thread/506753?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 14:36:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82b6aa02-3a88-45b4-b411-965262572d12</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;This is great to hear! Thank you for the update.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/thread/506324?ContentTypeID=1</link><pubDate>Tue, 15 Oct 2024 13:08:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94795832-9815-4a03-9bdc-b9d264bc9663</guid><dc:creator>esisk</dc:creator><description>&lt;p&gt;Thanks for pointing me in this direction. Once, I set CONFIG_MBEDTLS_SSL_SERVER_NAME_INDICATION=y, both the sample and my project worked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/thread/506176?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2024 14:47:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e7eff19-6087-4c86-ab23-e63d266d0834</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;To check ca_certificate[], you could try to specify your ca_certificate[] as mentioned in the &lt;a href="https://academy.nordicsemi.com/courses/wi-fi-fundamentals/lessons/lesson-5-wifi-fundamentals/topic/lesson-5-exercise-2-2/"&gt;lesson 5&lt;/a&gt; of Wi-Fi Fundamentals course. When you do that, do you still get the same error -113?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/thread/506082?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2024 11:35:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:038653eb-8571-4447-9874-1283df680b0d</guid><dc:creator>esisk</dc:creator><description>&lt;p&gt;By getting the same error, I mean that I&amp;#39;m getting &lt;em&gt;mqtt_connect, error: -113. &lt;/em&gt;Here&amp;#39;s the entire log:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.261,260] &amp;lt;inf&amp;gt; aws_iot_sample: The AWS IoT sample started, version: v1.0.0
[00:00:00.271,636] &amp;lt;inf&amp;gt; aws_iot_sample: Bringing network interface up and connecting to the network
[00:00:00.289,581] &amp;lt;dbg&amp;gt; mqtt_helper: mqtt_helper_poll_loop: Waiting for connection_poll_sem
[00:00:00.338,867] &amp;lt;inf&amp;gt; wifi_mgmt_ext: Connection requested
[00:00:00.354,278] &amp;lt;dbg&amp;gt; mqtt_helper: mqtt_state_set: State transition: MQTT_STATE_UNINIT --&amp;gt; MQTT_STATE_DISCONNECTED
uart:~$ &amp;gt; wifi connect -s ssid -p pw -k 1
wifi connect -s ssid -p pw -k 1
Connection requested
Connected
[00:00:11.434,204] &amp;lt;inf&amp;gt; aws_iot_sample: Network connectivity established
[00:00:16.443,664] &amp;lt;inf&amp;gt; aws_iot_sample: Connecting to AWS IoT
[00:00:16.452,362] &amp;lt;dbg&amp;gt; mqtt_helper: broker_init: Resolving IP address for iot.dev.slatesafety.com
[00:00:16.560,272] &amp;lt;dbg&amp;gt; mqtt_helper: broker_init: IPv4 Address found 52.54.218.138 (AF_INET)
[00:00:16.571,441] &amp;lt;inf&amp;gt; mqtt_helper: Provision cert success
[00:00:16.579,742] &amp;lt;dbg&amp;gt; mqtt_helper: mqtt_state_set: State transition: MQTT_STATE_DISCONNECTED --&amp;gt; MQTT_STATE_TRANSPORT_CONNECTING
[00:00:17.064,300] &amp;lt;err&amp;gt; mqtt_helper: mqtt_connect, error: -113
[00:00:17.073,089] &amp;lt;dbg&amp;gt; mqtt_helper: mqtt_state_set: State transition: MQTT_STATE_TRANSPORT_CONNECTING --&amp;gt; MQTT_STATE_DISCONNECTED
[00:00:17.087,554] &amp;lt;err&amp;gt; aws_iot: mqtt_helper_connect, error: -113
[00:00:17.096,588] &amp;lt;err&amp;gt; aws_iot_sample: aws_iot_connect, error: -113
[00:00:17.105,926] &amp;lt;err&amp;gt; aws_iot_sample: Fatal error! Rebooting the device.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Looking at the mbedtls Github, I see that -0x2700 means&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/** Certificate verification failed, e.g. CRL, CA or signature check failed. */
#define MBEDTLS_ERR_X509_CERT_VERIFY_FAILED               -0x2700&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If I change&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;tls_cfg-&amp;gt;peer_verify	        = TLS_PEER_VERIFY_REQUIRED;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;tls_cfg-&amp;gt;peer_verify	        = TLS_PEER_VERIFY_NONE;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;the sample is able to connect to the MQTT broker successfully. So I know that the issue concerns the CA certificate. I&amp;#39;ve thought of a few possible root causes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The CA certificate is formatted incorrectly&lt;/li&gt;
&lt;li&gt;My sample is missing some crypto config variable being set&lt;/li&gt;
&lt;li&gt;There&amp;#39;s not enough heap memory for the TLS operations&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I think 1 is unlikely because I included the raw PEM files in my certs directory. They&amp;#39;re formatted the same as my device certificate and private key and I&amp;#39;m able to connect to the server and publish messages.&lt;/p&gt;
&lt;p&gt;I think 3 is unlikely because I have set&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_MBEDTLS_HEAP_SIZE=120000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;which should be plenty of space. I&amp;#39;ll include the entire config files that I&amp;#39;m using for the AWS IoT sample.&lt;/p&gt;
&lt;p&gt;nrf7002dk_nrf5340_cpuapp_ns.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Configuration file for nRF7002 DK
# This file is merged with prj.conf in the application folder, and options
# set here will take precedence if they are present in both files.

# General
CONFIG_POSIX_CLOCK=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=81920
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_HW_ID_LIBRARY_SOURCE_NET_MAC=y
CONFIG_POSIX_MAX_FDS=25

# Optimize Wi-Fi stack to save some memory
CONFIG_NRF700X_RX_NUM_BUFS=16
CONFIG_NRF700X_MAX_TX_AGGREGATION=4

# Wi-Fi
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_WIFI_MGMT_EXT=y
CONFIG_WIFI_CREDENTIALS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# Shell
CONFIG_SHELL=y
CONFIG_SHELL_STACK_SIZE=6144

# WPA
CONFIG_WPA_SUPP=y

# NET sockets
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
CONFIG_NET_SOCKETS_OFFLOAD=n
CONFIG_NET_DHCPV4=y
CONFIG_NET_CONTEXT_SNDTIMEO=y
CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_NET_RX_STACK_SIZE=2048

# DNS
CONFIG_DNS_RESOLVER=y
CONFIG_NET_SOCKETS_DNS_TIMEOUT=30000

# Make the MQTT helper library provision credentials prior to establishing a TLS connection.
# Credentials needs to be pasted into their respective entry under samples/net/aws_iot/certs/.
CONFIG_MQTT_HELPER_PROVISION_CERTIFICATES=y

# Native network stack
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=120000
CONFIG_MBEDTLS_RSA_C=y

# NET Sockets
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=2

# Zephyr NET Connection Manager Connectivity layer.
CONFIG_L2_WIFI_CONNECTIVITY=y
CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n
CONFIG_L2_WIFI_CONNECTIVITY_AUTO_DOWN=n

# Serial Peripheral Interface (SPI) - Used to communicate with the mx25r64 external flash memory.
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_SFDP_DEVICETREE=y
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

# Bootloader and FOTA related configurations

# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y
CONFIG_MCUBOOT_IMG_MANAGER=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_STREAM_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# AWS FOTA
CONFIG_AWS_FOTA=y
CONFIG_FOTA_DOWNLOAD=y
CONFIG_DFU_TARGET=y

# Download client (needed by AWS FOTA)
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_4096=y

# TLS credentials
# CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE=y

# Optimize TF-M
CONFIG_TFM_PROFILE_TYPE_SMALL=y
CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0xc000
CONFIG_PM_PARTITION_SIZE_TFM=0x1fe00
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and prj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# General
CONFIG_LOG=y
CONFIG_LOG_BUFFER_SIZE=2048
CONFIG_HW_ID_LIBRARY=y
CONFIG_ASSERT=y
CONFIG_JSON_LIBRARY=y
CONFIG_REBOOT=y

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=y
CONFIG_NET_IPV4=y
CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_NET_L2_WIFI_SHELL=y

# AWS IoT library
CONFIG_AWS_IOT=y
CONFIG_AWS_IOT_CLIENT_ID_STATIC=&amp;quot;test-bcn3&amp;quot;
CONFIG_MQTT_HELPER_SEC_TAG=301
CONFIG_MQTT_HELPER_CERTIFICATES_FOLDER=&amp;quot;src/certs&amp;quot;
CONFIG_AWS_IOT_BROKER_HOST_NAME=&amp;quot;sample.com&amp;quot;
CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=y
CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y
CONFIG_MBEDTLS_SERVER_NAME_INDICATION=y

# MQTT helper library
CONFIG_MQTT_HELPER=y
CONFIG_MQTT_HELPER_LAST_WILL=y
CONFIG_MQTT_HELPER_STACK_SIZE=4096
CONFIG_MQTT_HELPER_LOG_LEVEL_DBG=y

# MQTT - Maximum MQTT keepalive timeout specified by AWS IoT Core
CONFIG_MQTT_KEEPALIVE=1200
CONFIG_MQTT_CLEAN_SESSION=y
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/thread/506028?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2024 08:19:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6b92881-7ebd-40fa-895a-6cc781c1d6c9</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="esisk"]However, now I&amp;#39;m getting the same error that I had initially.[/quote]
&lt;p&gt;I see that you initially got&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;err&amp;gt; mqtt_helper: mqtt_connect, error: -113
&amp;lt;err&amp;gt; aws_iot: mqtt_helper_connect, error: -113
&lt;/pre&gt;&lt;br /&gt; and now you are getting&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;err&amp;gt; mqtt_helper: mqtt_connect, error: -2
&amp;lt;err&amp;gt; aws_iot: mqtt_helper_connect, error: -2
&lt;/pre&gt;&lt;br /&gt;What do you refer to as &amp;quot;getting the same error&amp;quot;?&amp;nbsp;Could you please clarify this?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Could you provide complete log?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/thread/505947?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2024 16:02:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b9d1b06-31c1-4112-8c42-147f5329e538</guid><dc:creator>esisk</dc:creator><description>&lt;p&gt;Yes I followed all those instructions. I placed the raw .pem files in the certs directory of the AWS IoT Sample, built and ran, and now I get&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:48.535,827] &amp;lt;err&amp;gt; mqtt_helper: mqtt_connect, error: -2
[00:00:48.544,433] &amp;lt;err&amp;gt; aws_iot: mqtt_helper_connect, error: -2
[00:00:48.553,314] &amp;lt;err&amp;gt; aws_iot_sample: aws_iot_connect, error: -2
[00:00:48.562,438] &amp;lt;err&amp;gt; aws_iot_sample: Fatal error! Rebooting the device.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Edit: I figured out that I had my CONFIG_MQTT_HELPER_CERTIFICATES_FOLDER variable set incorrectly. However, now I&amp;#39;m getting the same error that I had initially.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with TLS on nRF7002DK</title><link>https://devzone.nordicsemi.com/thread/505927?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2024 14:37:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae9ca6d5-7d3a-4e04-8edc-abb7b8abf0db</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Have you built the&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/net/aws_iot/README.html"&gt;AWS IoT&lt;/a&gt; sample for&amp;nbsp;&lt;span&gt;nrf7002dk/nrf5340/cpuapp/ns board target?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Have you followed the&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.7.0/page/nrf/samples/net/aws_iot/README.html#setup"&gt;setup&lt;/a&gt;&amp;nbsp;guide and read the Note in the same setup section which specifies that for nrf70 devices certificates must be provisioned at runtime?&lt;br /&gt;Documentation provides information how to&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.7.0/page/nrf/libraries/networking/aws_iot.html#generating_and_provisioning_certificates"&gt;generate and provision certificates&lt;/a&gt;&amp;nbsp;for nrf70 devices.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>