update signing procedure notes

This commit is contained in:
bunnie 2025-10-21 03:16:21 +08:00
parent 3e4b0b6571
commit 602ef2d8a4
No known key found for this signature in database
2 changed files with 12 additions and 1 deletions

View file

@ -10,14 +10,24 @@ Here is the flow for generating and deploying signatures:
1. The "HSM" (as it may be -- really just a signing token) is a Precursor/Baochip device. The signature type is `ed25519`. The device is primed with a PIN like a normal FIDO device.
1. A residential SSH key is created on the device using `ssh-keygen -t ed25519-sk`
1. The "private key" resulting from this contains the credential ID, public key, relying party,
2. Extract the credentials using e.g. `python3 .\extract_sk_credential.py .\bao2_id_ed25519_sk`
3. Paste the `_PUB` and `_CRED_ID` into the respective public key slot in `bao1x-api/src/pubkeys/`
4. Activate the `tag` field in the `PUBKEY` record. This will cause it to be considered for checking signatures.
5. Copy the base-64 representation of the cred-id into e.g. `credentials/bao2.json` so that `fido-signer` can refer to it. Note that the token also needs to have a PIN setup.
## Signing
2. The image to be signed is fed into `fido-signer`:
1. The signing token must be connected to the computer
1. The signing token must be connected to the computer
2. The PIN must be provided by the signer
3. Depending on the host, this may need to run at an elevated privilege level (Windows in particular enforces that)
3. Assuming the prequisites are met, `fido-signer` patches a unified signed Baochip image to inject the `signature` and `auth_data` into the designated key slot. It also generates a `.uf2` file for convenience.
Example command line of `fido-signer`, as run from the `signing/fido-signer` directory:
`cargo run -- --credential-file ..\credentials\bao2.json --file ..\..\target\riscv32imac-unknown-none-elf\release\bao1x-boot0.img --function-code boot0`
The `--function-code` argument is necessary to create the .uf2 file. Without it, only a .img file is updated.
In the case that a `deployment` key is used, additional physical security measures are invoked, a list of which are not publicly documented because in physical security, obscurity and the element of surprise are valid and useful countermeasures.
## Other notes

View file

@ -141,6 +141,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
name = "bao1x-api"
version = "0.1.0"
dependencies = [
"arbitrary-int",
"bitbybit",
"bytemuck",
"num-derive",