<?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>HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110371/https-without-t-fm-and-psa</link><description>Hello, 
 We are currently developing a WiFi library and just started on implementing HTTPS and ran into some issues. Since we don&amp;#39;t have enough flash and memory for using the T-FM image, we decided to work on the secure build (without *ns). As such we</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Jul 2024 11:09:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110371/https-without-t-fm-and-psa" /><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/493130?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 11:09:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b92558f0-111a-4591-9810-7db62851764c</guid><dc:creator>Daniel Figueira</dc:creator><description>&lt;p&gt;After a lot of trial and error I finally got HTTPS working:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Over WiFi: using the nRF7002DK (both with and without TFM - meaning the secure and the non-secure builds).&lt;/li&gt;
&lt;li&gt;Over LTE: using the nRF9161DK.&lt;/li&gt;
&lt;li&gt;Over Ethernet: using the nRF9161DK with an ethernet port extension.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Apart from these I also got it working on our custom WiFi and LTE/Ethernet boards, which are based on the 2 development kits just mentioned.&lt;br /&gt;&lt;br /&gt;To wrap things up I&amp;#39;ll post a description of what I had to do:&lt;br /&gt;&lt;br /&gt;1) In the first place I had to make sure all the certificates I imported are NULL terminated, otherwise I would get an error when importing them (already mentioned in a previous post).&lt;/p&gt;
&lt;p&gt;&lt;img style="cursor:zoom-in;max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-from-2024_2D00_04_2D00_24-14_2D00_01_2D00_20.png" /&gt;&lt;/p&gt;
&lt;p&gt;2) In the second place I had to make sure the code which imports the certificates (which is different between LTE and Wifi/Ethernet) was correct and was being called &lt;strong&gt;before&lt;/strong&gt; the network connection was established.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if defined(USE_LTE)
    bool present_in_modem = false;

    // Check if a certificate with the same tag is already present in the modem
    // (since the certificates added to the modem are persistent).
    if (!present_in_modem) {
        ret = modem_key_mgmt_exists(tag, MODEM_KEY_MGMT_CRED_TYPE_CA_CHAIN, &amp;amp;present_in_modem);
        if (ret != 0) {
            LOG_ERR(&amp;quot;Failed to check if TLS certificate with tag %d is already present &amp;quot;
                    &amp;quot;on the modem (err: %d)&amp;quot;,
                tag, ret);
            return ret;
        }
    }

    // Delete the old certificate (if different from the new)
    if (present_in_modem) {
        ret = modem_key_mgmt_cmp(tag, MODEM_KEY_MGMT_CRED_TYPE_CA_CHAIN, certificate, certificate_size);
        if (ret &amp;lt; 0) {
            LOG_ERR(&amp;quot;Failed to compare new TLS certificate with the one already&amp;quot;
                    &amp;quot;present on the modem (err: %d)&amp;quot;,
                ret);
            return ret;
        }
        // If the certificates do not match
        if (ret == 1) {
            ret = modem_key_mgmt_delete(tag, MODEM_KEY_MGMT_CRED_TYPE_CA_CHAIN);
            if (ret &amp;lt; 0) {
                LOG_ERR(&amp;quot;Failed to delete existing TLS certificate (err: %d)&amp;quot;, ret);
                return ret;
            }
            present_in_modem = false;
        }
    }

    // Add the new certificate (if not already present)
    if (!present_in_modem) {
        ret = modem_key_mgmt_write(tag, MODEM_KEY_MGMT_CRED_TYPE_CA_CHAIN, certificate, certificate_size);
        if (ret &amp;lt; 0) {
            LOG_ERR(&amp;quot;Failed to add TLS certificate (err: %d)&amp;quot;, ret);
            return ret;
        }
    }
#endif   // USE_LTE

#if defined(USE_ETHERNET) || defined(USE_WIFI)
    // Try to add the new certificate
    ret = tls_credential_add(tag, TLS_CREDENTIAL_CA_CERTIFICATE, certificate, certificate_size);
    if (ret &amp;lt; 0 &amp;amp;&amp;amp; ret != -EEXIST) {
        LOG_ERR(&amp;quot;Failed to add TLS certificate (err: %d)&amp;quot;, ret);
        return ret;
    }

    // If a certificate with the same tag already was present delete it and try again
    // (since we don&amp;#39;t have a way to verify if the certificate is the same)
    if (ret == -EEXIST) {
        ret = tls_credential_delete(tag, TLS_CREDENTIAL_CA_CERTIFICATE);
        if (ret &amp;lt; 0) {
            LOG_ERR(&amp;quot;Failed to delete existing TLS certificate (err: %d)&amp;quot;, ret);
            return ret;
        }
        ret = tls_credential_add(tag, TLS_CREDENTIAL_CA_CERTIFICATE, certificate, certificate_size);
        if (ret &amp;lt; 0) {
            LOG_ERR(&amp;quot;Failed to add TLS certificate (err: %d)&amp;quot;, ret);
            return ret;
        }
    }
#endif   // USE_ETHERNET || USE_WIFI&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I took me a while to understand that the certificates stored in the modem are persistent and stay on the modem even when I flash my board (for the LTE version at least...). This, grouped with some nasty bug I introduced when comparing the certificates, gave me a lot of headaches and resulted in very weird behaviors when trying to import different sets of certificates at the same time. Also good to know is that the value 0 is not a valid TAG and will result in a very hard-to-relate error (like all certificate and socket connection errors...).&lt;/p&gt;
&lt;p&gt;The tags used will then need to be added using setsockopt() when creating a TLS socket:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    // Open a new HTTPS socket
    connection.socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TLS_1_2);
    if (connection.socket &amp;lt; 0) {
        LOG_ERR(&amp;quot;Unable to create local HTTPS socket (err: %d, %s)&amp;quot;, errno, strerror(errno));
        return -errno;
    }

    // Set TLS credentials to be used
    ret = setsockopt(connection.socket, SOL_TLS, TLS_SEC_TAG_LIST, certificate_tags, certificate_count * sizeof(sec_tag_t));
    if (ret &amp;lt; 0) {
        LOG_ERR(&amp;quot;Failed to set TLS certificate list (err: %d, %s)&amp;quot;, errno, strerror(errno));
        disconnect();
        return -errno;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;One would expect connect() to now work, however at this point you will most likely run into one or more somewhat obscure error codes returned by the connect() method - leading us to point 3...&lt;/p&gt;
&lt;p&gt;3) Make sure you&amp;#39;re using the right zephyr configurations, based on the network type, zephyr build (secure vs. non-secure) and the type of certificates used.&lt;/p&gt;
&lt;p&gt;For me this was the hardest step, since I had to rely mostly on trial and error to come up with the minimal set of configs I seem to need:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="python"&gt;config USE_HTTPS
    bool &amp;quot;Enable HTTPS requests&amp;quot;
    default n
    select USE_HTTP
    # LTE dependencies
    select MBEDTLS_CCM_C if USE_LTE
    select MBEDTLS_ECP_C if USE_LTE
    select MBEDTLS_TLS_LIBRARY if USE_LTE
    # WiFi dependencies
    select MBEDTLS_RSA_C if USE_WIFI
    select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY if USE_WIFI &amp;amp;&amp;amp; !BUILD_WITH_TFM
    select PSA_WANT_RSA_KEY_SIZE_4096 if USE_WIFI &amp;amp;&amp;amp; !BUILD_WITH_TFM
    # Ethernet dependencies
    select MBEDTLS_RSA_C if USE_ETHERNET
    select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY if USE_ETHERNET
    select PSA_WANT_RSA_KEY_SIZE_4096 if USE_ETHERNET

    help
        Enable the use of HTTPS requests

# Configure the TLS heap size
# Note: needs to be adjusted depending on the number of certificates being 
# used at the same time. Seems to cause problems if smaller than 60000.
configdefault MBEDTLS_HEAP_SIZE
    default 81920 if USE_WIFI &amp;amp;&amp;amp; !BUILD_WITH_TFM
    default 81920 if USE_ETHERNET

# Configure the MPI component buffers sizes (used for public key operations)
# Note: needs to be adjusted depending on the max RSA key size supported
configdefault MBEDTLS_MPI_MAX_SIZE
    default 512 if PSA_WANT_RSA_KEY_SIZE_4096
    default 256 if PSA_WANT_RSA_KEY_SIZE_2048

# Enable TLS level error logs for HTTPS operations
# TLS error code list: https://gist.github.com/erikcorry/b25bdcacf3e0086f8a2afb688420678e
config ENABLE_HTTPS_DEBUG_MODE
    bool &amp;quot;Enable TLS error logs&amp;quot;
    default n
    depends on USE_HTTPS
    select MBEDTLS_DEBUG
    select MBEDTLS_DEBUG_C
    select MBEDTLS_SSL_DEBUG_ALL
    help
        Enable TLS error logs during HTTPS operations

# Increase the MBEDTLS_DEBUG_LEVEL further if more details are needed
configdefault MBEDTLS_DEBUG_LEVEL
    default 1 if ENABLE_HTTPS_DEBUG_MODE&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(note that these only contain the configs I had to add on top of the configs already present for normal HTTP...)&lt;/p&gt;
&lt;p&gt;For these I had to take in consideration the types of certificates I was trying to use (namely the algorithm and the key size) and adjust my settings accordingly. &lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1720604394950v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;For google.com for example, I needed to enable the RSA algorithm and add support for 2048 byte sized keys (this is a picture of the Firefox web browser which I used to download the certificates I needed)...&lt;/p&gt;
&lt;p&gt;At this point it really helped to enable the MBEDTLS error logs as suggested by&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/stefan-schmidt"&gt;Stefan Schmidt&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Then I needed to make sure I had enough space for the heap and the buffers that are used by the TLS libs - since I&amp;#39;m not using only a specific certificate but a list of certificates that might vary in number/type.&lt;/p&gt;
&lt;p&gt;I was then able to successfully connect to different servers using the certificates I had, however there was still one step left I had to do...&lt;br /&gt;&lt;br /&gt;4) Understanding how the Zephyr http_client layer works and the specifics of the servers I&amp;#39;m connecting to (which applies to both HTTP and HTTPS requests).&lt;br /&gt;&lt;br /&gt;At this point I was able to successfully send HTTP requests over TLS to the servers, however this didn&amp;#39;t meant that the servers would accept the requests I was sending, or maybe some servers did and some others did not... So, after doing some debugging and comparing the requests being sent using Zephyr&amp;#39;s http_client versus the raw HTTP requests sent by the HTTPS sample I ended up with some not-so-obvious rules when it comes to building HTTP requests using Zephyr&amp;#39;s http_client, which seem to make the requests I&amp;#39;m sending compatible across different servers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The http_request &amp;#39;url&amp;#39; field should not be left as NULL. When sending a request to the root path of the server the url needs to be set to &amp;#39;\&amp;#39; instead.&lt;/li&gt;
&lt;li&gt;The http_request &amp;#39;port&amp;#39; field is better left unset. Passing a value to it will cause the port to be appended to the &amp;quot;Host:&amp;quot; header of the request that is automatically generated by the http_client - which will cause some servers to reject your requests.&lt;/li&gt;
&lt;li&gt;The hostname should either be added to the&amp;nbsp;http_request &amp;#39;host&amp;#39; field or present in the &amp;#39;Host:&amp;#39; header set through the http_request &amp;#39;headers&amp;#39; field, &lt;strong&gt;but not both&lt;/strong&gt; - since it will cause the &amp;quot;Host:&amp;quot; header to be duplicated which might cause problems on the server side.&lt;/li&gt;
&lt;li&gt;The &amp;quot;Content-Length:&amp;quot; header should not be used since it is already automatically generated based on the http_request &amp;#39;body_len&amp;#39; field (even if left unset/zeroed).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;All headers manually added to the http_request &amp;#39;headers&amp;#39; field should to be \r\n terminated - otherwise the request will be malformed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I was then finally able to send my HTTPS request to multiple servers, over different network types, with and without T-FM.&lt;/p&gt;
&lt;p&gt;Hopefully this will be of use for those who face similar problems in the future...&lt;br /&gt;&lt;br /&gt;I&amp;#39;m open to any further comments you might have, otherwise feel free to close this topic.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Daniel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/490759?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2024 06:57:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82f2f6e1-cbec-44c5-8741-279397843434</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Since last time we talked here, a collegua of me made changes to a sample that may be what you need:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/111996/example-code-for-https-client-using-wifi-nrf7002-nrf5340/489074"&gt;RE: Example code for HTTPS client using WiFi nRF7002 + nRF5340&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;See the last comment in this ticket.&lt;br /&gt;Is this what you need?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/490630?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 12:25:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e992c3e-bcd0-4090-bf29-72bc20eb2181</guid><dc:creator>Daniel Figueira</dc:creator><description>&lt;p&gt;Sorry for not providing any updates in a long time, but I&amp;#39;ve been pretty busy... &lt;br /&gt;&lt;br /&gt;Honestly, apart from project configuration you provided on how to run the HTTPS sample without TF-M, the rest of the answers I got weren&amp;#39;t really helpful, so we gave up on trying to HTTPS requests with no TF-M on a nRF7002DK board around a month ago...&lt;br /&gt;&lt;br /&gt;Instead we decided to move onto a nRF9160 board and send the HTTPS requests over LTE - which as been working fine for now.&lt;br /&gt;&lt;br /&gt;Eventually we are going to want to have the same behavior over WiFi and maybe then I&amp;#39;ll have to try to tackle this issue once again... but for now I&amp;#39;m not sure when that will happen.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/488595?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2024 06:38:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cabde4ed-4f39-4252-aebb-0957ed45c5c7</guid><dc:creator>Stefan Schmidt</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;what I found very helpful in debugging TLS were these debug settings:&lt;br /&gt;CONFIG_MBEDTLS_DEBUG=y&lt;br /&gt;CONFIG_MBEDTLS_DEBUG_C=y&lt;br /&gt;CONFIG_MBEDTLS_DEBUG_LEVEL=4&lt;br /&gt;CONFIG_MBEDTLS_LOG_LEVEL_DBG=y&lt;br /&gt;CONFIG_MBEDTLS_SSL_DEBUG_ALL=y&lt;br /&gt;CONFIG_LOG_BUFFER_SIZE=20000&lt;/p&gt;
&lt;p&gt;(provided by Hakon here:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/110151/configuration-for-native-tls-no-offload-to-modem"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/110151/configuration-for-native-tls-no-offload-to-modem&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;and this page with an overview of MBED TLS errors:&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://gist.github.com/erikcorry/b25bdcacf3e0086f8a2afb688420678e"&gt;https://gist.github.com/erikcorry/b25bdcacf3e0086f8a2afb688420678e&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Stefan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/488521?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 13:55:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3a04c8a-1361-40e0-bd9a-22e294ff6d8d</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/v2.6.1/samples/net/aws_iot/certs"&gt;https://github.com/nrfconnect/sdk-nrf/tree/v2.6.1/samples/net/aws_iot/certs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/eef645c4a31201df353fdff5447262d7675fa1c1/samples/net/aws_iot/CMakeLists.txt#L21"&gt;https://github.com/nrfconnect/sdk-nrf/blob/eef645c4a31201df353fdff5447262d7675fa1c1/samples/net/aws_iot/CMakeLists.txt#L21&lt;/a&gt; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/488413?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 05:39:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8a479e1-041e-448c-a641-e8072762d78e</guid><dc:creator>Stefan Schmidt</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;how do&amp;nbsp;you use&amp;nbsp;the certificate in your firmware?&lt;/p&gt;
&lt;p&gt;I usually download the certificates,&amp;nbsp;modify them like described here (&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0/nrf/libraries/modem/modem_key_mgmt.html#certificates"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0/nrf/libraries/modem/modem_key_mgmt.html#certificates&lt;/a&gt;) and include them in an C array:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;const&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;uint8_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;g_ca_certificate&lt;/span&gt;&lt;span&gt;[]&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;#include&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;quot;../cloud-certs/AmazonRootCA1.pem&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/480707?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2024 13:10:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0898a7cc-da7a-459c-8166-538b9a6b241c</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;What you need is to read up on Certificate Authorities (CAs).&lt;/p&gt;
&lt;p&gt;I will try to sum it up: Webpages are signed with a cert. You can use a public key to verify the signature. But you must trust the signer, so the signer is always a CA.&lt;/p&gt;
&lt;p&gt;The key you put on the device to trust the page is a CA public key.&lt;/p&gt;
&lt;p&gt;All webpages do not have the same CA, so if you connect to two pages with different CAs, you will need different CA keys. Web browsers have a lot of CA keys in them for this reason.&lt;/p&gt;
&lt;p&gt;For the nRF9160, you usually only need to connect to a handful of web pages for a product, so it is in most cases enough one CA key.&lt;/p&gt;
&lt;p&gt;Disclaimer: I am probably not 100% correct, so I suggest you read on this from some more knowledgable source on the web&lt;/p&gt;
&lt;p&gt;Did this make sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/480690?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2024 12:33:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3018ba7-ceb9-4ffe-aecc-bb0ca0972bb9</guid><dc:creator>Daniel Figueira</dc:creator><description>&lt;p&gt;Hi once again. &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Maybe just to clarify, my end goal is to be able to perform HTTPS requests without the use of TF-M (previously I was unaware I could use PSA without TF-M) - ultimately we basically want to send data through HTTPS to an AWS server.&lt;/p&gt;
&lt;p&gt;With the HTTPS_client sample configs you provided I guess it is now proven that having HTTPS without TF-M can be done (which was not covered by the Wifi Fundamental tutorials)... &lt;br /&gt;&lt;br /&gt;However, after following your advice on how to download the certificates I needed through my web browser, I seem unable to use the HTTPS_client sample to connect to any server I tried except for &amp;quot;example.com&amp;quot; and &amp;quot;echo.thingy.rocks&amp;quot; (which I managed to connect to after updating the version of the certificate I previously had).&lt;br /&gt;&lt;br /&gt;For any other well-known addresses out there, like &amp;#39;google.com&amp;#39; for instance, I always get a ECONNABORTED error (113) with no further details, even though I&amp;#39;m using the certificates provided by my browser.&lt;br /&gt;&lt;br /&gt;After reading a bit on other tickets about the subject I tried to disable peer validation but still wasn&amp;#39;t able to connect to &amp;#39;google.com&amp;#39; which now leads me to wander if it might be somehow related to the cyphers I&amp;#39;m using (as suggested in the reply to: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/68229/nrf9160-unable-to-disable-certificate-validation-when-connecting-to-https"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/68229/nrf9160-unable-to-disable-certificate-validation-when-connecting-to-https&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;I&amp;#39;d appreciate some more help with this issue.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Daniel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/480470?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2024 13:09:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c740660-7d67-459f-b364-f0129fab56cf</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;It could sound to me like you got the wrong certs for the webpage you try to connect to.&lt;/p&gt;
&lt;p&gt;I think that if you go the the webpage in a browser, you can look at the security settings for the webpage and get which certs you need from there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/480447?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2024 12:22:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeee5649-5930-4ec0-909d-5b4871f5f0e7</guid><dc:creator>Daniel Figueira</dc:creator><description>&lt;p&gt;The HTTPS_client sample also seems to work for me with the configs you provided &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f44d.svg" title="Thumbsup"&gt;&amp;#x1f44d;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I tried to use the HTTPS_client sample to connect to the server used by &amp;#39;wififund_less5_exer2&amp;#39; (echo.thingy.rocks) with the certificate provided for that lesson (which we&amp;#39;ve been using in our tests) and I figured out that by null-terminating that certificate like shown on the HTTPS_client sample:&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-from-2024_2D00_04_2D00_24-14_2D00_01_2D00_20.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I no longer get the EINVAL error code (22) - which makes sense since I previously did not understand why connect would be returning EINVAL:&amp;nbsp;&lt;a id="" href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html"&gt;https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I still get an ECONNABORTED error (113) - which is not described on the connect() function, but seems to make more sense...&lt;br /&gt;&lt;br /&gt;I&amp;#39;ll try to look a bit more into it later this week. If I can&amp;#39;t manage to connect to &amp;#39;echo.thingy.rocks&amp;#39; (nordic server) I&amp;#39;ll use the server (example.com) and certificates from the HTTPS_client sample instead and see how that goes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/480255?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 14:47:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dff54a61-0f90-4fb6-9a58-5b2fa388f3af</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Worked for me on nrf7002dk_nrf5340_cpuapp now. That is a good sign.&lt;/p&gt;
&lt;p&gt;Let me know how your test goes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/480023?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 13:49:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:097cfcde-32fa-498a-be1d-84ae5de81025</guid><dc:creator>Daniel Figueira</dc:creator><description>&lt;p&gt;Hi Sigurd, tomorrow I won&amp;#39;t be able to, but Wednesday I will give this a try see how it goes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/479981?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 12:08:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8236e156-7122-45b4-806e-2846d22b34d3</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;(Optional) To learn about the PSA Crypto API, see &amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/securing-iot-products-with-psa-certified-apis"&gt;Securing IoT products with PSA Certified APIs&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;
&lt;p&gt;One of the big upsides with the PSA Crypto API is that it should do the same both with and without TF-M, so your code should function the same (if a tad less securely) without TF-M.&lt;/p&gt;
&lt;p&gt;So out of the gate, I think that what you try should work.&lt;/p&gt;
&lt;p&gt;Can you try our &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/net/https_client/README.html"&gt;HTTPS Client&lt;/a&gt; example without TF-M? &lt;br /&gt;Reason I ask for a sample is because that makes this easier to try and reproduce from my side.&lt;br /&gt;Here is the overlay I used for nrf7002dk_nrf5340_cpuapp.conf, which maybe work:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# General
CONFIG_POSIX_CLOCK=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=81920
CONFIG_NET_RX_STACK_SIZE=2048

# 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_NRF700X_LOG_LEVEL_ERR=y
CONFIG_WIFI_MGMT_EXT=y
CONFIG_WIFI_CREDENTIALS=y


# Shell
CONFIG_SHELL=y
CONFIG_SHELL_STACK_SIZE=6144

# WPA supplicant
CONFIG_WPA_SUPP=y
CONFIG_WPA_SUPP_LOG_LEVEL_ERR=y

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

# DNS
CONFIG_DNS_RESOLVER=y
CONFIG_NET_SOCKETS_DNS_TIMEOUT=30000

# NET sockets
CONFIG_NET_NATIVE=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_TCP=y
CONFIG_NET_TCP_WORKQ_STACK_SIZE=2048
CONFIG_NET_UDP=y
CONFIG_NET_SOCKETS_OFFLOAD=n
CONFIG_NET_DHCPV4=y
CONFIG_NET_CONTEXT_SNDTIMEO=y

# TLS networking
CONFIG_NET_SOCKETS_ENABLE_DTLS=n
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=2
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y

# TLS credentials
CONFIG_FLASH=y
Here is the overlay I used for nrf7002dk_nrf5340_cpuapp
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_WIFI_CREDENTIALS_BACKEND_SETTINGS=y
CONFIG_TLS_CREDENTIALS_BACKEND_VOLATILE=y

# mbedTLS
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=81920
CONFIG_PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY=y
CONFIG_PSA_WANT_RSA_KEY_SIZE_2048=y
CONFIG_MBEDTLS_RSA_C=y
CONFIG_MBEDTLS_TLS_LIBRARY=y


CONFIG_WIFI_CREDENTIALS_STATIC=y
CONFIG_WIFI_CREDENTIALS_STATIC_SSID=&amp;quot;&amp;quot;
CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD=&amp;quot;&amp;quot;

CONFIG_PM_SINGLE_IMAGE=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I say &amp;quot;maybe&amp;quot; because I did not get to test it yet. I planned to but then Monday happened and I do not have access to a nRF7002DK until tomorrow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HTTPS without T-FM and PSA</title><link>https://devzone.nordicsemi.com/thread/479710?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 12:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7cbb6fda-95ae-496f-a58a-2fd3b3860b35</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will look into this and return with more information on Monday.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>