Skip to content

Support ECC key import in all asymmetric slots - #56

Open
FlorianFranzen wants to merge 1 commit into
trussed-dev:mainfrom
FlorianFranzen:feat/ecc-import
Open

FlorianFranzen wants to merge 1 commit into
trussed-dev:mainfrom
FlorianFranzen:feat/ecc-import

Conversation

@FlorianFranzen

Copy link
Copy Markdown
Contributor

The Yubico IMPORT ASYMMETRIC KEY extension only accepted RSA keys, and only into slot 9A. This adds a P-256/P-384 arm that reads the private scalar from DO 0x06 (zero-padded to the curve's scalar size, as ykman and yubikey.rs send it), injects it through the existing unsafe_inject_key path, and accepts every asymmetric key reference including the retired slots. The RSA path is left as it is. The PIN and touch policy DOs those clients append are ignored, as GENERATE ASYMMETRIC ignores them today.

The zero scalar is rejected in the app because the software fallback behind the virt platform accepts it while real backends reject it, which keeps behaviour identical across backends; an out-of-range scalar is rejected by the backend.

Tests import into 9A, 9C, 9E and retired slots, exercise the per-slot PIN conditions, verify the resulting ECDSA signatures against verifying keys recomputed from the imported scalars (ECDSA is randomized, so signature bytes cannot be compared directly), and reject truncated, wrong-curve, all-zero and out-of-range scalars.

Refs #16

FlorianFranzen added a commit to FlorianFranzen/piv-authenticator that referenced this pull request Oct 16, 2026
…es (stacked))

- 08ffd56 Support ECC key import in all asymmetric slots
- 207d0db Implement GET METADATA for all key references
- 2b4f8cb Clear the default flag when the management key changes
- 9584d37 Store and enforce pin and touch policies
FlorianFranzen added a commit to FlorianFranzen/piv-authenticator that referenced this pull request Oct 16, 2026
- 08ffd56 Support ECC key import in all asymmetric slots
- bb7f6a6 Accept ECDSA digests up to the field size, left-padded like a YubiKey
FlorianFranzen added a commit to FlorianFranzen/piv-authenticator that referenced this pull request Oct 16, 2026
@mirko

mirko commented Oct 25, 2026

Copy link
Copy Markdown

Hijacking this thread: could anybody tell my why there is an artificial restriction into only allowing importing keys into slot 9D and not e.g. into the retired ones? I couldn't find anything reasoning. Is this maybe, because retired slots got introduced only later into the firmware and this restriction is a remnant?

This branch has not been deployed

No deployments
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