@@ -177,11 +177,23 @@ internal_bench/bytebuf:
177177
178178## Test key/certificates
179179
180- SSL/TLS tests in ` multi_net ` and ` net_inet ` use a
181- self-signed key/cert pair that is randomly generated and to be used for
182- testing/demonstration only. You should always generate your own key/cert.
180+ SSL/TLS tests in ` multi_net ` and ` net_inet ` use self-signed key/cert pairs
181+ that are randomly generated to be used for testing/demonstration only.
183182
184- To generate a new self-signed RSA key/cert pair with openssl do:
183+ To run tests on-device the ` .der ` files should be copied and the current time
184+ set to ensure certs validity. This can be done with:
185+ ```
186+ $ mpremote rtc --set
187+ $ mpremote cp multi_net/*.der :
188+ $ mpremote cp net_inet/*.der :
189+ ```
190+
191+ ### Generating new test key/certificates
192+
193+ The keys used for the unit tests are included in the tests folders so don't generally
194+ need to be re-created by end users. This section is included here for reference only.
195+
196+ A new self-signed RSA key/cert pair can be created with openssl:
185197```
186198$ openssl req -x509 -newkey rsa:2048 -keyout rsa_key.pem -out rsa_cert.pem -days 365 -nodes -subj '/CN=micropython.local/O=MicroPython/C=AU'
187199```
@@ -193,8 +205,10 @@ $ openssl pkey -in rsa_key.pem -out rsa_key.der -outform DER
193205$ openssl x509 -in rsa_cert.pem -out rsa_cert.der -outform DER
194206```
195207
196- To test elliptic curve key/cert pairs, create a key then a certificate using:
208+ For elliptic curve tests using key/cert pairs, create a key then a certificate using:
197209```
198- $ openssl ecparam -name prime256v1 -genkey -noout -out ec_key.der -outform DER
199- $ openssl req -new -x509 -key ec_key.der -out ec_cert.der -outform DER -days 365 -nodes -subj '/CN=micropython.local/O=MicroPython/C=AU'
210+ $ openssl ecparam -name prime256v1 -genkey -noout -out ec_key.pem
211+ $ openssl x509 -in ec_key.pem -out ec_key.der -outform DER
212+ $ openssl req -new -x509 -key ec_key.pem -out ec_cert.der -outform DER -days 365 -nodes -subj '/CN=micropython.local/O=MicroPython/C=AU'
200213```
214+
0 commit comments