|
| 1 | +# Signing keys |
| 2 | + |
| 3 | +Each project using MCUBoot requires signing keys to sign the firmware images. These keys are used to |
| 4 | +verify the integrity and authenticity of the firmware during the boot process. |
| 5 | + |
| 6 | +In most cases, the project will require only a single signing key, due to using a single application |
| 7 | +firmware. If more than one application firmware is needed, multiple signing keys are probably needed |
| 8 | +as well. |
| 9 | + |
| 10 | +## Creating the first signing key |
| 11 | + |
| 12 | +1. Create a signing key file using the following command from the root of the project: |
| 13 | + |
| 14 | + ```shell |
| 15 | + east bypass -- python3 ../bootloader/mcuboot/scripts/imgtool.py keygen -t ecdsa-p256 -k app/signing_key.pem |
| 16 | + ``` |
| 17 | + |
| 18 | +2. Create an entry in 1Password and paste contents of the created signing key file, so that it can |
| 19 | + be used by other developers. Use GitHub repository name and keys purpose as the entry title, for |
| 20 | + example `client-project-firmware - Main application signing key`. |
| 21 | + |
| 22 | +3. Add a new GitHub secret with the signing key file contents: |
| 23 | + |
| 24 | + - Go to your GitHub repository. |
| 25 | + - Navigate to `Settings -> Secrets and variables -> Actions`. |
| 26 | + - Press the `New secret` button. |
| 27 | + - Set the name of the secret to `IMAGE_SIGN_KEY`, and paste the contents of the signing key file. |
| 28 | + |
| 29 | +The `app/signing_key.pem` file is not tracked by Git, so it will not be included in the repository. |
| 30 | +If you ever delete the file, you will need to recreate it from the 1Password entry. |
| 31 | + |
| 32 | +## Creating additional signing keys |
| 33 | + |
| 34 | +For each additional signing key you need to create, follow these steps: |
| 35 | + |
| 36 | +1. Follow the steps from the "Creating the first signing key" section to create an additional |
| 37 | + signing key. Use a different name for the signing key file, 1Password entry and GitHub secret. |
| 38 | + Use a consistent naming scheme. |
| 39 | +2. Update the `env` section in each workflow file (found in `.github/workflow`) that calls the |
| 40 | + `make pre-build` target. The `env` section should convert the secret into an environment |
| 41 | + variable, e.g. `EXTRA_IMAGE_SIGN_KEY: ${{ secrets.EXTRA_IMAGE_SIGN_KEY}}`. |
| 42 | +3. Update the `pre-build` make target in the `Makefile` by adding an additional call to the |
| 43 | + `create_signing_keys.sh` script with chosen signing key filename. |
0 commit comments