You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These examples demonstrate how to use dtls via mbedtls on a Pico W device.
4
-
You need to define DTLS_SERVER and run the makecerts.sh script to generate the certificates and keys needed for the server and client.
4
+
You need to define DTLS_SERVER and run the `makecerts.sh` script to generate the certificates and keys needed for the server and client.
5
5
```
6
6
export DTLS_SERVER=myserver
7
7
cd dtls/certs
@@ -12,36 +12,34 @@ The examples should now build.
12
12
# Running the dtls examples
13
13
14
14
The client connects to a server and sends it a few lines of text which it expects to be sent back.
15
-
16
-
You can build and run the client and server examples on two Pico W devices. To make testing easier to test with just one Pico W device, you can run the server or client on a Linux host.
17
-
The client.sh and server.sh scripts show how to run the client or server with openssl. The host folder contains source code for a version of the client and server using mbedtls.
15
+
You can build and run the client and server examples on two Pico W devices, or to test with just one Pico W device, you can run the server or client on a Linux host.
18
16
19
17
## Using openssl
20
18
21
-
The host/server.sh and host/client/sh scripts demonstrate how to use DTLS with openssl, although you will have to echo text manually.
22
-
For example, run dtls_echo_client on a Pico W device and the server.sh on a linux PC.
19
+
The `host/server.sh` and `host/client.sh` scripts demonstrate how to use DTLS with openssl, although you will have to echo text manually.
20
+
For example, run dtls_echo_client on a Pico W device and the `server.sh` on a linux host.
23
21
```
24
22
export DTLS_SERVER=myserver
25
23
cd host
26
24
./server.sh
27
25
```
28
26
The scripts use the keys in certs/myserver
29
27
30
-
Or run dtls_echo_server on a Pico W device and client.sh on a linux PC. The host name for the server on Pico W is set to `pico_dtls_example`"`. Make sure you build the code for the Pico W and run the client with the right DTLS_SERVER name (and matching keys in the client and server) or else the SSL handshake will fail.
28
+
Or run dtls_echo_server on a Pico W device and `client.sh` on a linux host. The host name for the server on Pico W is set to `pico_dtls_example`. Make sure you build the code for the Pico W and run the client with the right DTLS_SERVER name (and matching keys in the client and server) or else the SSL handshake will fail.
31
29
```
32
30
export DTLS_SERVER=pico_dtls_example
33
31
ping pico_dtls_example # make sure you can reach it!
34
32
cd host
35
33
./client.sh
36
34
```
37
-
The scripts use the keys in certs/pico_dtls_example. Type a sentence into the client.sh console and the server should send it back as a reply.
35
+
The scripts use the keys in certs/pico_dtls_example. Type a sentence into the `client.sh` console and the server should send it back as a reply.
38
36
39
37
## Using mbedtls
40
38
41
39
The host folder contains C versions of the examples that can be compiled natively for the host. They are modified versions of mbedtls examples.
42
-
You can build these on a rpi linux device to act as the server or client. The mbedtls library in PICO_SDK_PATH will be used to build the host code.
40
+
If you are building the server or client on a linux host, the mbedtls library in PICO_SDK_PATH will be used to build the code.
43
41
44
-
For example, run dtls_echo_client on a Pico W device and the dtls_host_echo_server on a linux PC.
42
+
For example, run dtls_echo_client on a Pico W device and the dtls_host_echo_server on a linux host.
45
43
```
46
44
export DTLS_SERVER=myserver
47
45
cd host
@@ -52,7 +50,7 @@ make -j8
52
50
./dtls_host_echo_server
53
51
54
52
```
55
-
Or run dtls_echo_server on a Pico W device and dtls_host_echo_client on a linux PC.
53
+
Or run dtls_echo_server on a Pico W device and dtls_host_echo_client on a linux host.
56
54
```
57
55
export DTLS_SERVER=pico_dtls_example
58
56
cd host
@@ -62,4 +60,4 @@ cmake ..
62
60
make -j8
63
61
./dtls_host_echo_client
64
62
```
65
-
Remember to build the client and server for the host and Pico W with the correct value of DTLS_SERVER or else the handshake will fail.
63
+
Remember to build the client and server for the linux host and Pico W with the correct value of DTLS_SERVER or else the handshake will fail.
0 commit comments