From 602ef2d8a423401188ec01cd7570777ebc8c86fa Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 21 Oct 2025 03:16:21 +0800 Subject: [PATCH] update signing procedure notes --- signing/README.md | 12 +++++++++++- signing/fido-signer/Cargo.lock | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/signing/README.md b/signing/README.md index 8c88ec9f0..cfe441320 100644 --- a/signing/README.md +++ b/signing/README.md @@ -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 diff --git a/signing/fido-signer/Cargo.lock b/signing/fido-signer/Cargo.lock index 42620a8c8..97b3e9f21 100644 --- a/signing/fido-signer/Cargo.lock +++ b/signing/fido-signer/Cargo.lock @@ -141,6 +141,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" name = "bao1x-api" version = "0.1.0" dependencies = [ + "arbitrary-int", "bitbybit", "bytemuck", "num-derive",