Skip to content

[htool] Add SecurityV2 attestation key management commands - #297

Open
willyzha wants to merge 4 commits into
google:mainfrom
willyzha:htool-security-attestation-key
Open

willyzha wants to merge 4 commits into
google:mainfrom
willyzha:htool-security-attestation-key

Conversation

@willyzha

Copy link
Copy Markdown

Add subcommands under 'htool security' for managing attestation keys on devices supporting SecurityV2:

  • unload_attestation_key (Major 1, Minor 3)
  • gen_attestation_key_v1 (Major 1, Minor 15)
  • gen_attestation_key_v2 (Major 1, Minor 18)
  • load_attestation_key (Major 1, Minor 1)
  • load_attestation_key_from_csr_v1 (Major 1, Minor 16)
  • provision_attestation_key (one-shot unload + gen_v1 + load_from_csr_v1)

Include unit tests covering success and error paths for each command.

Add subcommands under 'htool security' for managing attestation keys on
devices supporting SecurityV2:
- unload_attestation_key (Major 1, Minor 3)
- gen_attestation_key_v1 (Major 1, Minor 15)
- gen_attestation_key_v2 (Major 1, Minor 18)
- load_attestation_key (Major 1, Minor 1)
- load_attestation_key_from_csr_v1 (Major 1, Minor 16)
- provision_attestation_key (one-shot unload + gen_v1 + load_from_csr_v1)

Include unit tests covering success and error paths for each command.
@willyzha
willyzha marked this pull request as ready for review September 15, 2026 20:21
willyzha and others added 3 commits September 17, 2026 20:28
read_exact_file rejects any input file that is not exactly the expected
length, and the generated outputs are always fixed size, but the flag
descriptions did not say what those sizes are. Spell them out so the
requirement is discoverable from --help instead of only from a failure
message.

  wrapped key                 88 bytes
  attestation key CSR v1     256 bytes
  attestation key CSR v2     192 bytes
  CA-signed certificate      192 bytes

Help text only; no behaviour change.
htool_security_certificates.c was the only file in this area still
sending every diagnostic to stdout, which mixes error text into piped
certificate output and diverges from the 23 of 33 files under examples/
that already use stderr. All 28 prints in the file are error paths, so
convert them wholesale rather than leaving the file half-and-half.

Two message defects fixed while here:
  - "Unknown Alias Key Version received: %d" had no trailing newline.
  - Two "Returned status %d,  while trying" messages had a doubled
    space and were split mid-phrase across string literals.

No test asserts on stdout or stderr, and no status codes change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant