Skip to content

Commit 0c81ffd

Browse files
committed
tests/multi_net: Generate smaller certs with 2048-bit RSA.
Otherwise running the tests can take a long time when the server is a slow target (RP2040 takes 23 seconds for a handshake when using 4096-bit RSA). Also add instructions on how to generate elliptic curve key/certs. Signed-off-by: Damien George <[email protected]>
1 parent f0392b8 commit 0c81ffd

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

tests/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ SSL/TLS tests in `multi_net` and `net_inet` use a
181181
self-signed key/cert pair that is randomly generated and to be used for
182182
testing/demonstration only. You should always generate your own key/cert.
183183

184-
To generate a new self-signed key/cert pair with openssl do:
184+
To generate a new self-signed RSA key/cert pair with openssl do:
185185
```
186-
$ openssl req -x509 -newkey rsa:4096 -keyout rsa_key.pem -out rsa_cert.pem -days 365 -nodes
186+
$ 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'
187187
```
188188
In this case CN is: micropython.local
189189

@@ -192,3 +192,9 @@ Convert them to DER format:
192192
$ openssl rsa -in rsa_key.pem -out rsa_key.der -outform DER
193193
$ openssl x509 -in rsa_cert.pem -out rsa_cert.der -outform DER
194194
```
195+
196+
To test elliptic curve key/cert pairs, create a key then a certificate using:
197+
```
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'
200+
```

tests/multi_net/rsa_cert.der

-554 Bytes
Binary file not shown.

tests/multi_net/rsa_key.der

-1.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)