Skip to content

Add ECDH command - #88

Merged
mmlado merged 1 commit into
mainfrom
74-add-ecdh-command
Oct 11, 2026
Merged

mmlado merged 1 commit into
mainfrom
74-add-ecdh-command

Conversation

@mmlado

@mmlado mmlado commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Closes #74

  • Add ecdh(public_key, path): INS 0xC5, P1 0x01, P2 0x00, data = 65-byte uncompressed peer key + path; returns the 32-byte X coordinate, a raw secret for the caller's KDF
  • A key that is not 65 bytes starting with 0x04, or a relative path, raises ValueError before sending, since a wrong key length would shift the path the card reads
  • The card limits paths to the NIP-44 and EIP-1581 subtrees at least 5 levels deep (0x6985) and rejects points off the curve (0x6A80); both surface as APDUError
  • Hardware tests compare the card's secret with the peer-side computation against the card's exported public key; on 3.x the call raises APDUError 0x6D00

- ecdh(public_key, path) returns the 32-byte X coordinate of the shared point
- INS 0xC5, P1 0x01, P2 0x00, data = uncompressed peer key + path
- The card limits paths to the NIP-44 and EIP-1581 subtrees
@mmlado mmlado linked an issue Oct 11, 2026 that may be closed by this pull request
@mmlado
mmlado merged commit b4c5697 into main Oct 11, 2026
6 checks passed
@mmlado mmlado self-assigned this Oct 11, 2026
@mmlado
mmlado deleted the 74-add-ecdh-command branch October 11, 2026 12:55
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.

Add ECDH command

1 participant