Skip to content

feat(secureboot): configurable signing key size (2048 default, 4096 opt-in)#172

Merged
Bugs5382 merged 2 commits into
mainfrom
feat/171-sb-key-bits
Jul 16, 2026
Merged

feat(secureboot): configurable signing key size (2048 default, 4096 opt-in)#172
Bugs5382 merged 2 commits into
mainfrom
feat/171-sb-key-bits

Conversation

@Bugs5382

Copy link
Copy Markdown
Contributor

What and why

The Secure Boot signing key was hardcoded to RSA-2048. That stays the
default (the UEFI spec mandates RSA-2048 PKCS#1 v1.5 for db image
authentication, and ECDSA in db is inconsistent across firmware), but an
operator who knows their firmware accepts RSA-4096 can now opt into a
stronger key for this long-lived (~10-year) db certificate.

  • secureboot.Options gains KeyBits; zero means the 2048 default.
  • Only {2048, 4096} are accepted; any other size returns an error.
  • cryptos-sbkey exposes --bits (default 2048).
  • Choosing a non-default size prints a stderr warning: some firmware only
    accepts RSA-2048 in db, and a key the firmware won't load means the
    signed image won't boot.
  • docs/secure-boot.md documents the flag and the warning.

Closes #171

Verification

  • Lint clean
  • Tests pass
  • Build succeeds
  • Documentation updated (if behavior or API changed)

How this was verified

  • go test ./internal/secureboot/... ./cmd/cryptos-sbkey/... - all green,
    including new subtests for KeyBits 0 (default), 2048, 4096, and the
    rejected sizes 3072 and 1024.
  • task ci (fmt, lint, vet, test, build) - passes clean, 0 lint issues.
  • task license - 0/208 files changed, all headers already present.

…pt-in)

Add Options.KeyBits to internal/secureboot so callers can opt into a
4096-bit RSA key for the Secure Boot db certificate instead of the
2048-bit default. Only 2048 and 4096 are accepted; any other size is
rejected with a clear error.

Expose this as --bits on cryptos-sbkey (default 2048). Selecting a
non-default size prints a warning to stderr: not every firmware
implementation accepts RSA-4096 in db, and a key the firmware won't
load means the signed image won't boot. Update docs/secure-boot.md to
cover the flag and the warning.

Closes #171
@Bugs5382 Bugs5382 added this to the v1.0.0 milestone Jul 16, 2026
@Bugs5382 Bugs5382 added the enhancement New feature (feat). Minor version bump. label Jul 16, 2026
@Bugs5382 Bugs5382 self-assigned this Jul 16, 2026
An unsupported --bits value is rejected by secureboot.Generate, so emitting
the firmware-compat warning for it first was misleading. Gate the warning on
the one valid opt-in size (4096).
@Bugs5382
Bugs5382 merged commit ac7346b into main Jul 16, 2026
13 checks passed
@Bugs5382
Bugs5382 deleted the feat/171-sb-key-bits branch July 16, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature (feat). Minor version bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(secureboot): configurable signing key size (default RSA-2048, opt-in RSA-4096)

1 participant