Skip to content

feat: add secp256r1 to the ECDSA curves in the interface spec - #394

Open
MRmarioruci wants to merge 1 commit into
mainfrom
feat/ecdsa-secp256r1-variant
Open

MRmarioruci wants to merge 1 commit into
mainfrom
feat/ecdsa-secp256r1-variant

Conversation

@MRmarioruci

@MRmarioruci MRmarioruci commented Sep 15, 2026

Copy link
Copy Markdown

New variant secp256r1 of ecdsa_curve, selecting threshold ECDSA on the NIST P-256 curve in ecdsa_public_key and sign_with_ecdsa. P-256 is the curve the web platform standardised on: WebAuthn, TLS, VAPID web push (ES256) and OAuth DPoP. A canister cannot produce any of those signatures today, so each one needs a key held off-chain.

Changes

Key derivation for the new curve is the same generalization of BIP32 instantiated over P-256, which is SLIP-10. signing/key_derivation.rs:210 dispatches Ed25519 => eddsa_ckd, _ => bip32_ckdpub, so K256 and P256 run the same code, and bip32_ckdpub documents itself as following SLIP-0010 with BIP32 identical for K256. The derivation paragraph is split into one bullet per curve, matching how schnorr_public_key already presents its two algorithms. Signatures are encoded as for secp256k1, because EccCurveType::scalar_bytes is 32 on both curves, so r and s are 32 bytes each. The ecdsa_curve argument of ic0.cost_sign_with_ecdsa accepts 1, and the changelog bullet goes under the current 0.67.0 heading.

Two things deliberately left out. The u32 value 1 is normative, since it is the System API ABI, so it has to agree with dfinity/ic: please confirm it before this merges. And this describes the interface, not availability. Whether a given key_id exists depends on the implementation, so the pages that list the keys deployed on mainnet are unchanged, docs/references/management-canister.md included. Those should change when a key is generated.

Paired with dfinity/ic#11573, which adds the variant to the implementation.

Tests

didc check public/references/ic.did passes, and node scripts/validate.js passes on the three changed markdown files.

🤖 Generated with Claude Code

New variant `secp256r1` of `ecdsa_curve`, selecting threshold ECDSA on the
NIST P-256 curve in `ecdsa_public_key` and `sign_with_ecdsa`.

Key derivation for the new curve is the same generalization of BIP32
instantiated over P-256, which is SLIP-10. The derivation paragraph is split
into one bullet per curve, matching how `schnorr_public_key` already presents
its two algorithms. Signatures are encoded as for `secp256k1`: P-256 has a
256-bit group order, so r and s are 32 bytes each. The `ecdsa_curve` argument
of `ic0.cost_sign_with_ecdsa` accepts 1.

This describes the interface, not availability. As for any curve, whether a
given `key_id` exists depends on the implementation, so the pages listing the
keys deployed on mainnet are unchanged.
@github-actions github-actions Bot added the interface-spec Changes to the IC interface specification label Sep 15, 2026
@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown

🤖 Here's your preview: https://kwnd6-zaaaa-aaaam-ai7va-cai.icp0.io

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved review comments were identified, and the interface and documentation changes are consistent.

Pull request overview

Adds secp256r1 support to the IC interface specification for threshold ECDSA.

Changes:

  • Adds the P-256 Candid curve variant.
  • Documents SLIP-10 derivation and 64-byte signatures.
  • Maps System API curve value 1 to P-256 and updates the changelog.
File summaries
File Description
public/references/ic.did Adds the secp256r1 variant.
docs/references/ic-interface-spec/management-canister.md Documents P-256 derivation and signatures.
docs/references/ic-interface-spec/changelog.md Records the interface addition.
docs/references/ic-interface-spec/canister-interface.md Documents the numeric curve mapping.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@MRmarioruci
MRmarioruci marked this pull request as ready for review September 15, 2026 12:54
@MRmarioruci
MRmarioruci requested review from a team as code owners September 15, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interface-spec Changes to the IC interface specification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants