Skip to content

Signing scheme fixes - #757

Merged
renatav merged 6 commits into
masterfrom
renatav/fix-schema-specification
Jul 9, 2026
Merged

Signing scheme fixes#757
renatav merged 6 commits into
masterfrom
renatav/fix-schema-specification

Conversation

@renatav

@renatav renatav commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Description (e.g. "Related to ...", etc.)

Signing scheme is now detected from the actual key instead of always being assumed as RSA, as a first step toward supporting elliptic-curve keys.

While tracing how scheme was used, it was found it was already dead in most places outside of key generation, as well as a couple of real bugs: add_role/add_target_repo silently requested non-default scheme when creating new keys, and two functions called register_target_files with misaligned argument. Added tests.

Work on #446

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Changelog has been updated, as needed (see CHANGELOG.md)

renatav added 6 commits July 8, 2026 00:10
_from_crypto() now derives the scheme (RSA or ECDSA P-256) from the
actual key bytes instead of assuming RSA, so keys are loaded
correctly regardless of type without callers needing to know it in
advance (e.g. reading a YubiKey's public key).

Adds test_ecdsa_keys.py covering detection, curve/scheme validation,
and a sign/verify round trip.
Scheme only matters for key generation; loading/signing now uses the
key's own (auto-detected) scheme. Removed the dead parameter across
taf/keys.py, taf/keystore.py, the api/* signing/loading functions,
and their CLI commands. Also fixes bugs found along the way:
add_role/add_target_repo dropped the requested scheme, two functions
called register_target_files with misaligned positional arguments,
and key_cmd_prompt passed scheme into the wrong parameter.
add_role's scheme argument reached the Role model but was never
forwarded into actual key generation, so new keys were always tagged
rsa-pkcs1v15-sha256. Threads scheme through load_signer_from_pem so
it reaches the real key. Adds skip_prompt to add_target_repo
(mirroring add_role) and tests for add_role/add_target_repo scheme
handling and update_and_sign_targets (previously untested).
get_sslib_key_from_value and is_valid_metadata_key defaulted to the
RSA scheme string, forcing _from_crypto into an awkward tuple check
to also treat it as "no opinion" for EC keys. Default to None
everywhere instead, so there's exactly one sentinel.
@renatav renatav changed the title Renatav/fix schema specification Signing schema fixes Jul 8, 2026
@renatav renatav changed the title Signing schema fixes Signing scheme fixes Jul 8, 2026
@renatav
renatav marked this pull request as ready for review July 8, 2026 22:54
@renatav
renatav requested a review from n-dusan July 8, 2026 22:54
@renatav renatav self-assigned this Jul 8, 2026
@renatav
renatav merged commit 4cbe356 into master Jul 9, 2026
10 checks passed
@renatav
renatav deleted the renatav/fix-schema-specification branch July 9, 2026 13:31
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.

2 participants