{ "$schema": "../../schema/test-vector.schema.json", "name": "ECDH Shared Secret (X25519)", "spec_ref": "src/15-identity.md", "protocol_version": 0, "description": "X25519 ECDH key exchange test vectors. MeshCore uses Ed25519 keys transposed to X25519 for key exchange. The resulting 32-byte shared secret is used as: AES key (bytes 0-15) and HMAC key (bytes 0-31).", "vectors": [ { "id": "ecdh-001", "description": "RFC 7748 Test Vector: X25519 key exchange (Alice's perspective)", "type": "encode_decode", "structured": { "header": { "version": 0, "payload_type": "raw_custom", "route_type": "flood" }, "path": { "hash_size": 1, "hash_count": 0, "hashes": [] }, "payload": { "data": "4A5D9D5BA4CE2DE1728E3BF480350F25E07E21C947D19E3376F09B3C1E161742" } }, "binary": "3D 00 4A5D9D5BA4CE2DE1728E3BF480350F25E07E21C947D19E3376F09B3C1E161742", "crypto_context": { "sender_private_key": "77076D0A7318A57D3C16C17251B26645DF4C2F87EBC0992AB177FBA51DB92C2A", "recipient_public_key": "DE9EDB7D7B7DC1B4D35B61C2ECE435373F8343C85B78674DADFC7E146F882B4F" }, "notes": "RFC 7748 Section 6.1. Alice's private key and Bob's public key produce the shared secret. Note: MeshCore transposes Ed25519 keys to X25519, so actual ECDH inputs differ from raw Ed25519 keys." }, { "id": "ecdh-002", "description": "RFC 7748 Test Vector: X25519 key exchange (Bob's perspective)", "type": "encode_decode", "structured": { "header": { "version": 0, "payload_type": "raw_custom", "route_type": "flood" }, "path": { "hash_size": 1, "hash_count": 0, "hashes": [] }, "payload": { "data": "4A5D9D5BA4CE2DE1728E3BF480350F25E07E21C947D19E3376F09B3C1E161742" } }, "binary": "3D 00 4A5D9D5BA4CE2DE1728E3BF480350F25E07E21C947D19E3376F09B3C1E161742", "crypto_context": { "sender_private_key": "5DAB087E624A8A4B79E17F8B83800EE66F3BB1292618B6FD1C2F8B27FF88E0EB", "recipient_public_key": "8520F0098930A754748B7DDCB43EF75A0DBF3A0D26381AF4EBA4A98EAA9B4E6A" }, "notes": "RFC 7748 Section 6.1. Bob's private key and Alice's public key produce the same shared secret as ecdh-001, verifying the commutative property of ECDH." }, { "id": "ecdh-003", "description": "X25519 with all-zeros private key scalar (edge case)", "type": "encode_decode", "structured": { "header": { "version": 0, "payload_type": "raw_custom", "route_type": "flood" }, "path": { "hash_size": 1, "hash_count": 0, "hashes": [] }, "payload": { "data": "0000000000000000000000000000000000000000000000000000000000000000" } }, "binary": "3D 00 0000000000000000000000000000000000000000000000000000000000000000", "crypto_context": { "sender_private_key": "0000000000000000000000000000000000000000000000000000000000000000", "recipient_public_key": "DE9EDB7D7B7DC1B4D35B61C2ECE435373F8343C85B78674DADFC7E146F882B4F" }, "notes": "Edge case: all-zero private key after clamping becomes a low-order scalar. X25519 with a clamped all-zero key (which becomes 0x40...00) against any public key. The all-zero shared secret indicates this is a degenerate key and implementations SHOULD reject it." } ] }