@@ -177,11 +177,21 @@ internal_bench/bytebuf:
177
177
178
178
## Test key/certificates
179
179
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.
183
182
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 cp multi_net/*.der net_inet/*.der :
187
+ ```
188
+
189
+ ### Generating new test key/certificates
190
+
191
+ The keys used for the unit tests are included in the tests folders so don't generally
192
+ need to be re-created by end users. This section is included here for reference only.
193
+
194
+ A new self-signed RSA key/cert pair can be created with openssl:
185
195
```
186
196
$ 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'
187
197
```
@@ -193,8 +203,9 @@ $ openssl pkey -in rsa_key.pem -out rsa_key.der -outform DER
193
203
$ openssl x509 -in rsa_cert.pem -out rsa_cert.der -outform DER
194
204
```
195
205
196
- To test elliptic curve key/cert pairs, create a key then a certificate using:
206
+ For elliptic curve tests using key/cert pairs, create a key then a certificate using:
197
207
```
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'
208
+ $ openssl ecparam -name prime256v1 -genkey -noout -out ec_key.pem
209
+ $ openssl x509 -in ec_key.pem -out ec_key.der -outform DER
210
+ $ 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'
200
211
```
0 commit comments