gencert.sh: Simplify certificate file generation commands

The command lines to generate certificate file for web server are
troublesome and their parameters confuse users. To clean up the steps per
James Le Cuirot suggestions, simplify openssl options and bash commands
in the generation script and README.

Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
This commit is contained in:
Shin'ichiro Kawasaki
2020-04-11 17:01:08 +09:00
parent e3c60f8ff3
commit f87a435f96
2 changed files with 13 additions and 16 deletions

View File

@@ -71,16 +71,7 @@ Installation
Generate and prepare a PEM certificate file.
```sh
$ cd ~/bluepy-scratch-link
$ openssl req -x509 -out scratch-device-manager.cer \
-keyout scratch-device-manager.key -newkey rsa:2048 -nodes -sha256 \
-subj '/CN=scratch-device-manager' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
$ openssl pkcs12 -inkey scratch-device-manager.key \
-in scratch-device-manager.cer \
-name "Scratch Link & Scratch Device Manager" \
-passout pass:Scratch -export -out scratch-device-manager.pfx
$ grep -h ^ scratch-device-manager.cer scratch-device-manager.key \
| tr -d '\r' > scratch-device-manager.pem
$ ./gencert.sh
```
6. If using a micro:bit, install Scratch-link hex on your device