Hi,
I am using nRF7002 DK, is there any other sample code for HTTPS client using WiFi nRF7002 + nRF5340?
I want something that does not use WiFi credentials library.
Hi,
I am using nRF7002 DK, is there any other sample code for HTTPS client using WiFi nRF7002 + nRF5340?
I want something that does not use WiFi credentials library.
Hi,
We have the HTTPS Client sample as part of the nRF Connect SDK.
Additionally, lesson 5 exercise 2 in our Wi-Fi Fundamentals course on DevAcademy shows how to add TLS to an HTTP connection. I recommend going through lesson 5 exercise 1 first, as that shows how to connect to the HTTP server.
These samples use the Wi-Fi credentials library, but you can disable it, then provide the Wi-Fi credentials and connect to the network manually using __wifi_args_to_params() and wifi_connect() as in the Wi-Fi Station sample.
Best regards,
Marte
Hi Marte,
Thanks for the reply. I have another question related to this.
Can we run Matter and a HTTPS client at the same time? Is there no conflict?
The reason I ask is that I have tried to integrate the example lesson 5 exercise 2 into the Matter template, I was able to connect to the WiFi network but I always encounter an error EINVAL when I tried to connect() to a socket.
...
IPv4 address of HTTP server found 3.163.189.31
socket: 9
Connecting to server failed, err: 22, Invalid argument
We wanted to support Matter over WiFi and be able to connect to a HTTPS server at the same time, that is why we wanted to do this.
Thanks for the response.
Hi,
Can you share how you integrated the HTTPS client into the Matter template? Have you tested if it works without TLS? If not, I would recommend starting with HTTP first and then adding TLS after that works.
Best regards,
Marte
Hi Marte,
I tried HTTP as you suggested, and I was able to connect to the server.
Then, I tried to add the TLS again but I am still getting the error 22 when trying to connect.
I am not building with TF-M because Matter template is not using it, do you think TF-M is really needed for TLS to work?
Hi Marte,
I tried HTTP as you suggested, and I was able to connect to the server.
Then, I tried to add the TLS again but I am still getting the error 22 when trying to connect.
I am not building with TF-M because Matter template is not using it, do you think TF-M is really needed for TLS to work?
Hi,
You do not need TF-M for TLS, but you must make changes to prj.conf.
By taking lesson 5 exercise 2 as a starting point, you will have to remove the following configs:
CONFIG_WPA_SUPP_CRYPTO_PSA=y # Wi-Fi Credentials CONFIG_WIFI_CREDENTIALS=y CONFIG_WIFI_CREDENTIALS_STATIC=n CONFIG_WIFI_CREDENTIALS_SHELL=y
And then you must add these:
CONFIG_MBEDTLS=y CONFIG_PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY=y CONFIG_PSA_WANT_RSA_KEY_SIZE_1024=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_HEAP_SIZE=81920
Here you see the complete diff:
diff --git a/lesson5/wififund_less5_exer2_solution/prj.conf b/lesson5/wififund_less5_exer2_solution/prj.conf index 56e790a..7a2e0e5 100644 --- a/lesson5/wififund_less5_exer2_solution/prj.conf +++ b/lesson5/wififund_less5_exer2_solution/prj.conf @@ -2,11 +2,6 @@ CONFIG_WIFI=y CONFIG_WIFI_NRF700X=y CONFIG_WPA_SUPP=y -CONFIG_WPA_SUPP_CRYPTO_PSA=y - -# Wi-Fi Credentials -CONFIG_WIFI_CREDENTIALS=y -CONFIG_WIFI_CREDENTIALS_STATIC=n # Networking Management API CONFIG_NET_MGMT=y @@ -18,7 +13,6 @@ CONFIG_WIFI_MGMT_EXT=y # Support for shell commands CONFIG_SHELL=y -CONFIG_WIFI_CREDENTIALS_SHELL=y CONFIG_SHELL_STACK_SIZE=4400 # Logging @@ -69,4 +63,10 @@ CONFIG_NET_BUF_DATA_SIZE=256 CONFIG_NET_TC_TX_COUNT=0 # HTTP -CONFIG_HTTP_CLIENT=y \ No newline at end of file +CONFIG_HTTP_CLIENT=y + +CONFIG_MBEDTLS=y +CONFIG_PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY=y +CONFIG_PSA_WANT_RSA_KEY_SIZE_1024=y +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=81920
Best regards,
Marte