<?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>Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98520/secure-connection-to-aws-iot-over-wifi</link><description>We are using nRF5340 and nRF7002 to build a WiFi connected device that integrates into our backend via AWS IoT Core. We are evaluating what the best way is to secure the private key for the TLS client authentication and whether we need an external Hardware</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 May 2023 15:11:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98520/secure-connection-to-aws-iot-over-wifi" /><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/428528?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 15:11:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8029fb07-5092-45de-be81-56dec5aba690</guid><dc:creator>erichotterbeefcurry</dc:creator><description>&lt;p&gt;Hi Johannes,&lt;/p&gt;
&lt;p&gt;Ahh ok, I see, we are not in production stage yet so I agree with you that when we reach the stage a more secure method should be used. The AWS IoT fleet provisioning looks like something we can utilize too. We are definitely interested to see and learn how you&amp;#39;ve implemented this... it&amp;#39;d be great if you can check to see if it can be made public, and thank you for the detailed answer!&lt;/p&gt;
&lt;p&gt;-Eric&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/428319?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 06:53:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61c12d4d-c05d-4f1c-99ad-bbfb4d86f64d</guid><dc:creator>Johannes Hutter</dc:creator><description>&lt;p&gt;Hey Eric,&lt;/p&gt;
&lt;p&gt;yes, with TLS credentials I mean the client certificate, private key and CA certificate. For developing and getting started it makes totally sense to just compile in the files with CONFIG_AWS_IOT_PROVISION_CERTIFICATES, but since you have to have a separate set of cert/key for each device and you don&amp;#39;t want to have your key as part of the unencrypted program, I wouldn&amp;#39;t use this config in production.&lt;/p&gt;
&lt;p&gt;We went with the AWS IoT fleet provisioning by claim (&lt;a id="" href="https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html"&gt;https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html&lt;/a&gt;) and provide the bootstrap credentials over a custom BLE GATT service. So basically during production, a provisioning device (a Raspberry Pi) connects over BLE to the product, sends WiFi credentials and a signed payload containing the bootstrap credentials. With those credentials we connect to AWS IoT and request the certificate/key and the thing registration (see &lt;a id="" href="https://aws.github.io/Fleet-Provisioning-for-AWS-IoT-embedded-sdk/v1.1.0/fleet_provisioning_design.html"&gt;https://aws.github.io/Fleet-Provisioning-for-AWS-IoT-embedded-sdk/v1.1.0/fleet_provisioning_design.html&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;You could also pre-generate the things and credentials and just push them on the device during production, but in the end you always re-implement the fleet provisioning process again... So I guess it is a bit of a trade-off where you want to have the complexity during production.&lt;/p&gt;
&lt;p&gt;Implementing this is a bit involved, since I had to touch the aws_iot library as well, but if there is interest, I can check whether we can make the implementation public&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/428287?ContentTypeID=1</link><pubDate>Tue, 30 May 2023 21:51:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:684f29cf-c8ae-456e-aa9f-9d0f2a203228</guid><dc:creator>erichotterbeefcurry</dc:creator><description>&lt;p&gt;Hi Johannes, thank you so much for replying! I followed your suggestions and the library is building&amp;amp;flashing to the board now! The only part I didn&amp;#39;t do was the TLS credentials, I wasn&amp;#39;t how the secrets (do you mean the aws private key here?) can be flashed, could you elaborate a bit more on how you provision the certificates onto nrf7002? It seems if I use the CONFIG_AWS_IOT_PROVISION_CERTIFICATES option, it will make the function calls to tls_add_credentials too... Other than that, things look great and I am moving forward with the aws_iot library in our program. Thanks so much again for replying, your answer really helped!&lt;/p&gt;
&lt;p&gt;-Eric&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/428033?ContentTypeID=1</link><pubDate>Tue, 30 May 2023 05:49:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59fd732d-e565-4cda-9b9f-e35845d9d90b</guid><dc:creator>Johannes Hutter</dc:creator><description>&lt;p&gt;Hey!&lt;/p&gt;
&lt;p&gt;Yes, I used the net/aws_iot library for the connection. Some of the pitfalls I had to debug the most probably are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Disable CONFIG_POSIX_API, but enable CONFIG_NET_SOCKETS_POSIX_NAMES&lt;/li&gt;
&lt;li&gt;Enable CONFIG_NET_SOCKETS_SOCKOPT_TLS and CONFIG_TLS_CREDENTIALS and set your credentials with tls_credential_add(CONFIG_AWS_IOT_SEC_TAG, TLS_CREDENTIAL_CA_CERTIFICATE, AWS_CA_CERT, sizeof(AWS_CA_CERT)) etc.&lt;/li&gt;
&lt;li&gt;Make sure your certificates and keys are in the right format (single null-terminated string, in PEM format with line feeds at the end of a line).&lt;/li&gt;
&lt;li&gt;Enable CONFIG_MQTT_CLEAN_SESSION to get the subscriptions enabled&lt;/li&gt;
&lt;li&gt;You cannot dynamically subscribe after connection with the library, so you have to set the number of subscriptions you want to have exactly and make sure you have the policy permissions to subscribe to them.&lt;/li&gt;
&lt;li&gt;I had to increase the number of posix file descriptors (CONFIG_POSIX_MAX_FDS) and disable the send timeout (CONFIG_AWS_IOT_SEND_TIMEOUT)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I went with storing the secrets encrypted on the flash and accepting them being plain text while in memory.&lt;/p&gt;
&lt;p&gt;If you have any specific question, let me know, maybe I can help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/428017?ContentTypeID=1</link><pubDate>Mon, 29 May 2023 22:03:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea6a3884-eb14-4a1c-b804-1b82ad33afbd</guid><dc:creator>erichotterbeefcurry</dc:creator><description>&lt;p&gt;Hi Johannes, I am working on integrating nrf7002 to my team&amp;#39;s backend via AWS IoT Core too. I&amp;#39;m using a nRF7002DK and it&amp;#39;s been hard to setup the net/aws_iot library because all examples I can find are nrf9160s using modems. Can I ask if the aws_iot library is what you used to set up the connection with AWS, and if it not, could you please give some guidance on how I should get the nrf7002 connected to AWS? Thank you so much, and I hope you have found a great solution for the problem you described in this post!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/421772?ContentTypeID=1</link><pubDate>Fri, 21 Apr 2023 13:17:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df4614ba-bc49-46c1-9bf9-1d7f3776a84d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think you can say TF-M is limited to toy samples. It is large yes, but we are working on optimizing the size. And it is the only method we support for isolation / security by separation, implementing a Secure Processing Environment (SPE) (see&amp;nbsp;An Introduction to Trusted Firmware-M (TF-M)). I will be what we support going forward, together with the PSA crypto API&amp;#39;s. And when it comes to key management etc that you ask about, we do not have any other future proof solutions than TF-M to suggest.&lt;/p&gt;
&lt;p&gt;Regarding&amp;nbsp;the unofficial KMU sample you found, that is a simple unofficial sample that I wrote a long time ago (for nRF Connect SDK 1.4) to show&amp;nbsp;basic KMU functionality, but it is not something I would recommend today.&lt;/p&gt;
&lt;p&gt;Our Wi-Fi support is still not mature, and not all features are in place yet, but I have discussed this with the relevant teams internally and they are working on it. So unless this is something you need to handle early and you need something fast, I would wait. As you have seen, there is some work needed to get the crypto library dependencies sorted out, and we are working on it, but we do not have anything yet. If you need this urgently, I will update here when we have something so that you don&amp;#39;t necessarily have to wait for a new SDK release.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/421568?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2023 16:41:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3be3a72d-5385-45ad-85fd-60e0b9d620b2</guid><dc:creator>Johannes Hutter</dc:creator><description>&lt;p&gt;Sorry that I keep being persistent here, but it is unfortunately quite frustrating to make progress on this topic and probably I am just missing something...&lt;/p&gt;
&lt;p&gt;What is the expected way to get a basic level of securing secrets with a product based on nRF7002 + nRF5340?&lt;/p&gt;
&lt;p&gt;I understand that TF-M is not supported (and the necessary image size seems to limit everything but toy samples anyway). It is also not possible to use the PSA APIs, since the WPA supplicant depends on the legacy security backend being enabled, which prevents for example importing keys to the CC312 via PSA APIs (&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/96872/psa-crypto-features-not-enabled-when-config_mbedtls_legacy_crypto_c-is-enabled/413738"&gt;RE: PSA crypto features not enabled when CONFIG_MBEDTLS_LEGACY_CRYPTO_C is enabled&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;So I am left with using the legacy APIs and the lower-level mbedTLS integration (&lt;a id="" href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/crypto/README.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/crypto/README.html&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;My plan was then to provision a hardware unique key via the library, derive an AES key from there and store it in the KMU. Secrets would then be stored on flash after being encrypted in the CC and decrypted and loaded into RAM when needed. Something similar to this sample implementation: &lt;a id="" href="https://github.com/einarthorsrud/kmu_sample"&gt;https://github.com/einarthorsrud/kmu_sample&lt;/a&gt;. However, it seems like the inclusion of the alternative implementations does not work as expected, since the mbedtls_aes_encrypt and mbedtls_aes_decrypt functions are not available.&lt;/p&gt;
&lt;p&gt;Is there any recommended way on how to manage secrets like private keys or WiFi credentials?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/kmu_5F00_sample.zip"&gt;devzone.nordicsemi.com/.../kmu_5F00_sample.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/420528?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 13:45:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8977e18-ccf9-4f11-9aa8-aa8ccc71651c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I cannot say it is not possible, it is just that we have not worked on it yet and I am not able to say what is needed in order to support it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/420515?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 13:19:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4584ece1-44cf-4a91-b255-1a4852ff74d9</guid><dc:creator>Johannes Hutter</dc:creator><description>&lt;p&gt;Ouh, that&amp;#39;s a pity! Just to be clear: It is also not possible to let WiFi use the &amp;quot;non-secure&amp;quot; crypto and have the TF-M for other crypto operations? It is simply not possible to use TF-M and WiFi in the same build currently?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/420512?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 13:12:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5478e1a-50f9-4837-a0ab-c3ef643594a0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It turns out that TF-M and Wi-Fi is unfortunately not supported at the moment. I have discussed with the team and we have a ticket for it, so this will come, but I do not have a time-frame for it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/420207?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 11:16:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1225ee75-3861-460f-b900-03e222ef749c</guid><dc:creator>Johannes Hutter</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;thanks for the response! I think I start to get an understanding of the separation and capabilities. For us it would then make sense to use the TF-M to protect the bootchain, securely de- and encrypt the private key for the client authentication certificate and protect the WiFi credentials.&lt;/p&gt;
&lt;p&gt;To get the TF-M image included and get familiar with the functionality, I want to combine the samples under &lt;span style="font-family:courier new, courier;"&gt;wifi/provisioning&lt;/span&gt; and &lt;span style="font-family:courier new, courier;"&gt;crypto/aes_cbc.&lt;span style="font-family:arial, helvetica, sans-serif;"&gt; For that I added following configs to the prj.conf in&amp;nbsp;&lt;span style="font-family:courier new, courier;"&gt;wifi/provisioning&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;span style="font-family:courier new, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_BUILD_WITH_TFM=y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_TFM_PROFILE_TYPE_NOT_SET=y&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_NRF_SECURITY=y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_MBEDTLS_PSA_CRYPTO_C=y&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_MBEDTLS_ENABLE_HEAP=y&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_MBEDTLS_HEAP_SIZE=8192&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_PSA_CRYPTO_DRIVER_OBERON=n&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;span style="font-family:courier new, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;and changed following configs (due to RAM limitations):&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;span style="font-family:courier new, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_NET_BUF_RX_COUNT=8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_NET_BUF_TX_COUNT=8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new, courier;"&gt;CONFIG_HEAP_MEM_POOL_SIZE=76800&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, the build doesn&amp;#39;t work because of undefined references to those two functions:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&gt;mbedtls_entropy_init()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:courier new, courier;"&gt;mbedtls_hardware_poll()&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;It seems to me that wpa_supplicant needs the entropy source which is provided by mbedtls, but including the nrf security backend does not provide an implementation when enabled I played around a lot with the various entropy configs, but can&amp;#39;t figure out how to include the correct combination. Can you help there?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;board target is nrf7002dk_nrf5340_cpuapp_ns, NCS version is v2.3.0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;On the main branch it also doesn&amp;#39;t work. There the Kconfig resolution already fails.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Secure connection to AWS IoT over WiFi</title><link>https://devzone.nordicsemi.com/thread/419703?ContentTypeID=1</link><pubDate>Tue, 11 Apr 2023 12:46:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e026dd70-572d-4a58-82d4-76179ac43c4f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]* How secure is the usage of the functionality provided in the nRF5340 compared to an external dedicated Hardware Security Module?[/quote]
&lt;p&gt;That depends on the module you are comparing with. The nRF5340 has a number of security features, like the KMU that can protect keys from being accessible from the CPU or debugger, and it has features that prevents code/data readout via a debugger etc. There are however security features you may find in other products that are not on the nRF5340, but what you need here is very application specific so it is up to you to specify your requirements / features you need, and then we can help to describe which of these exists and how they work in the nRF5340.&lt;/p&gt;
[quote user=""]* Is there a way (or even a sample) for the nRF5340+nRF7002 to transparently set up a client-authenticated TLS tunnel using a private key stored in the KMU?[/quote]
&lt;p&gt;We do not have any solution for that at this point. (WiFi support is currently in an early stage and more features and examples will be added in the future).&lt;/p&gt;
[quote user=""]* How does the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/nrf_security/README.html"&gt;Nordic Security Module&lt;/a&gt; relate to TFM?[/quote]
&lt;p&gt;The Nordic security module is a SW component that handles integration with various&amp;nbsp;crypto libraries and APIs. An important point here is that regardless of the backends, the future proof API to use with regards to crypto is PSA Crytpo, which is what is used in the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/crypto.html"&gt;crypto examples in the SDK.&lt;/a&gt;&amp;nbsp;TF-M implements a secure processing environment. Typically, secrets will be handled by TF-M, and other parts of the application will then be non-secure and not have access to certain data (liek keys) and hardware. See &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/an-introduction-to-trusted-firmware-m-t-m"&gt;An Introduction to Trusted Firmware-M (TF-M)&lt;/a&gt;. You can also see more in the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/security.html"&gt;Security chapter in the SDK documentation&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>