<?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>[TCP with TLS on nRF7002-DK] mbedtls_ssl_handshake() function returns error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105717/tcp-with-tls-on-nrf7002-dk-mbedtls_ssl_handshake-function-returns-error--2700-mbedtls_err_x509_cert_verify_failed</link><description>Hello, 
 I&amp;#39;m trying to connect to a TCP server with TLS enabled, on nRF7002-DK. 
 By debugging step by step, I observed that `mbedtls_ssl_handshake()` function returned error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED). Error description is &amp;quot;Certificate</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 Nov 2023 12:51:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105717/tcp-with-tls-on-nrf7002-dk-mbedtls_ssl_handshake-function-returns-error--2700-mbedtls_err_x509_cert_verify_failed" /><item><title>RE: [TCP with TLS on nRF7002-DK] mbedtls_ssl_handshake() function returns error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/456408?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2023 12:51:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f77cdd14-97ec-487f-900f-cb5fc9d0e710</guid><dc:creator>JulienP_BL</dc:creator><description>&lt;p&gt;Hi Simon.&lt;/p&gt;
&lt;p&gt;To be honest I did not find either any code explicitly related to key size. I&amp;#39;ll retry to find some, and will eventually add logs.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using SDK 2.4.2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [TCP with TLS on nRF7002-DK] mbedtls_ssl_handshake() function returns error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/456385?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2023 12:12:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45034d1c-558b-43ee-bb12-003516575c5b</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Okay, then it could very well be the TLS certificates that are wrong, but that&amp;#39;s hard to confirm from my side. Are you able to print them out or something when you receive them and compare the certificates with what the peripheral&amp;nbsp;&lt;strong&gt;should&amp;nbsp;&lt;/strong&gt;transmit. From the log you do see, it does seem to be too weak for your application to accept. The peer verification is indeed recommended for proper security, as not verifying the peer will make your client susceptible to certain attacks I believe.&lt;/p&gt;
&lt;p&gt;Also, what SDK version are you using for development, because I&amp;#39;m not able to find the &amp;quot;&lt;em&gt;certificate key too weak&lt;/em&gt;&amp;quot; line anywhere in the nRF Connect SDK v2.5.0.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [TCP with TLS on nRF7002-DK] mbedtls_ssl_handshake() function returns error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/456001?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2023 14:15:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d1ace1b-57cf-46ec-b731-87c38cc94d3e</guid><dc:creator>JulienP_BL</dc:creator><description>&lt;p&gt;Sorry, I did not answer your question: my project is a demo FW which is based on several samples indeed (HTTP, TCP, FTP). But as a result, my code is pretty different than the various samples used as a reference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [TCP with TLS on nRF7002-DK] mbedtls_ssl_handshake() function returns error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/455998?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2023 14:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90915f54-994d-430f-9755-ea7d96de40f1</guid><dc:creator>JulienP_BL</dc:creator><description>&lt;p&gt;Hi Simon.&lt;/p&gt;
&lt;p&gt;Thank you for your help.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I had already read the thread you mention before sending my question: it helped me solving an issue which is mentioned in that same thread by Eric (error -EINVAL = -22). So, setting&amp;nbsp;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;strong&gt;CC3XX_BACKEND=y&lt;/strong&gt; and &lt;strong&gt;OBERON_BACKEND=n&lt;/strong&gt; in my project&amp;#39;s config file&lt;/span&gt;&lt;/span&gt; solved this first issue indeed (error -EINVAL returned by `connect()` function).&lt;/p&gt;
&lt;p&gt;Then, a new issue appeared: that&amp;#39;s error MBEDTLS_ERR_X509_CERT_VERIFY_FAILED which is returned by `mbedtls_ssl_handshake()` as described in my question. This issue is observed even with both &amp;quot;X_BACKEND&amp;quot; flag settings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [TCP with TLS on nRF7002-DK] mbedtls_ssl_handshake() function returns error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/455975?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2023 12:56:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc1ab8aa-2ead-49b7-ba73-103436984b26</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Julien&lt;/p&gt;
&lt;p&gt;Is your project based on one of the samples in the nRF Connect SDK? We had a long case ongoing this summer with similar issues (&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/100826/nrf7002dk-and-tls-sockets--7100-error"&gt;here &lt;/a&gt;for reference). And we had some issues with the Oberon backend in terms of handling the key exchange that could end up causing this issue. What ended up fixing this issue back then was setting&amp;nbsp;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;strong&gt;CC3XX_BACKEND=y&lt;/strong&gt; and &lt;strong&gt;OBERON_BACKEND=n&lt;/strong&gt; in your project&amp;#39;s&amp;nbsp; config file. If that doesn&amp;#39;t help, please try reading the case I linked to and see if you find something helpful. And if you&amp;#39;re still not able to resolve this we can suspect the TLS certificates being wrong.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Best regards,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Simon&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [TCP with TLS on nRF7002-DK] mbedtls_ssl_handshake() function returns error -2700 (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/455827?ContentTypeID=1</link><pubDate>Wed, 15 Nov 2023 17:13:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96b1dac8-a66f-4604-9ba4-09d38fbde032</guid><dc:creator>JulienP_BL</dc:creator><description>&lt;p&gt;Additional information: there is no error anymore when I set TLS_PEER_VERIFY_OPTIONAL (and I&amp;#39;m able to communicate properly with the server).&lt;/p&gt;
&lt;p&gt;This option is probably not recommended, I guess ! But does it confirm at least that the TLS certificates provided by my customer are wrong ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>