spec: incorporate MeshCore discussion #2538 review feedback

Incorporates two of the three corrections raised by msmuenchen on
discussion #2538:

- Identity: document that the 64-byte Ed25519 private key is the
  expanded `a || RH` (orlp) form, not a 32-byte seed, and that it
  cannot be consumed by standard Ed25519 libraries. Touches
  15-identity.md and 14-crypto.md.
- Group: document the GRP_TXT/GRP_DATA inner plaintext format
  (timestamp + flags + message) and the GRP_TXT length limits in
  08-payload-group.md.

The third correction (GRP_DATA vs RAW_CUSTOM app differentiation) is
deferred pending reviewer clarification.

Corpus: replace the unrealistic group vectors with valid inner-format
plaintexts; the ed25519 vectors now carry the 64-byte expanded key and
the seed; the schema and validator gain seed fields. Also corrects two
pre-existing wrong values found while verifying -- ed-001's public key
and ed-002's signature now match RFC 8032.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Opus 4.7 committed 2026-05-20 19:11:19 -06:00
1 parent 9232c16f7c
commit 9d7b1c6281
8 files changed
+144 -32

No files matched your search

+13 -10
View File
@@ -3,7 +3,7 @@
"name": "Ed25519 Sign/Verify",
"spec_ref": "src/15-identity.md",
"protocol_version": 0,
"description": "Ed25519 signature test vectors. MeshCore uses Ed25519 for advertisement signing. These vectors use RFC 8032 test keypairs for cross-validation.",
"description": "Ed25519 signature test vectors. MeshCore uses Ed25519 for advertisement signing. These vectors use RFC 8032 Section 7.1 test keypairs for cross-validation. crypto_context carries both the 32-byte seed (sender_seed) and the 64-byte expanded private key (sender_private_key, the clamped scalar a || nonce prefix RH) that MeshCore actually stores; see src/15-identity.md, 'Private Key Format'.",
"vectors": [
{
"id": "ed-001",
@@ -26,11 +26,12 @@
},
"binary": "3D 00 E5564300C360AC729086E2CC806E828A84877F1EB8E5D974D873E065224901555FB8821590A33BACC61E39701CF9B46BD25BF5F0595BBE24655141438E7A100B",
"crypto_context": {
"sender_private_key": "9D61B19DEFFD5A60BA844AF492EC2CC44449C5697B326919703BAC031CAE7F60",
"sender_public_key": "D75A980182B10AB7D54BFED3C964073A0EE172F3DAA3F4A18446B0B8D183F8E3",
"sender_seed": "9D61B19DEFFD5A60BA844AF492EC2CC44449C5697B326919703BAC031CAE7F60",
"sender_private_key": "307C83864F2833CB427A2EF1C00A013CFDFF2768D980C0A3A520F006904DE94F9B4F0AFE280B746A778684E75442502057B7473A03F08F96F5A38E9287E01F8F",
"sender_public_key": "D75A980182B10AB7D54BFED3C964073A0EE172F3DAA62325AF021A68F707511A",
"plaintext": ""
},
"notes": "RFC 8032 Section 7.1 Test Vector 1. Private key (seed) is 32 bytes; the 64-byte format used by MeshCore includes the expanded key. Signature over empty message."
"notes": "RFC 8032 Section 7.1 Test Vector 1. sender_seed is the 32-byte RFC seed; sender_private_key is the 64-byte expanded form (a || RH) that MeshCore stores. Signature over an empty message."
},
{
"id": "ed-002",
@@ -48,16 +49,17 @@
"hashes": []
},
"payload": {
"data": "92A009A9F0D4CAB8720E820B5F642540A2B27B5416503F8FB3762223EBDB69DA085AC1E43E159C7E94B2BA35F6F6A1918E25682F9B0ADC5C33C2BF3C39F04E50"
"data": "92A009A9F0D4CAB8720E820B5F642540A2B27B5416503F8FB3762223EBDB69DA085AC1E43E15996E458F3613D0F11D8C387B2EAEB4302AEEB00D291612BB0C00"
}
},
"binary": "3D 00 92A009A9F0D4CAB8720E820B5F642540A2B27B5416503F8FB3762223EBDB69DA085AC1E43E159C7E94B2BA35F6F6A1918E25682F9B0ADC5C33C2BF3C39F04E50",
"binary": "3D 00 92A009A9F0D4CAB8720E820B5F642540A2B27B5416503F8FB3762223EBDB69DA085AC1E43E15996E458F3613D0F11D8C387B2EAEB4302AEEB00D291612BB0C00",
"crypto_context": {
"sender_private_key": "4CCD089B28FF96DA9DB6C346EC114E0F5B8A319F35ABA624DA8CF6ED4FB8A6FB",
"sender_seed": "4CCD089B28FF96DA9DB6C346EC114E0F5B8A319F35ABA624DA8CF6ED4FB8A6FB",
"sender_private_key": "68BD9ED75882D52815A97585CAF4790A7F6C6B3B7F821C5E259A24B02E502E514566848291DACAF225CC63DEB348DA318E2C2E17B00B8160F9CE6BFA0472911D",
"sender_public_key": "3D4017C3E843895A92B70AA74D1B7EBC9C982CCF2EC4968CC0CD55F12AF4660C",
"plaintext": "72"
},
"notes": "RFC 8032 Section 7.1 Test Vector 2. Signature over the single byte 0x72."
"notes": "RFC 8032 Section 7.1 Test Vector 2. sender_seed is the 32-byte RFC seed; sender_private_key is the 64-byte expanded form (a || RH) that MeshCore stores. Signature over the single byte 0x72."
},
{
"id": "ed-003",
@@ -80,11 +82,12 @@
},
"binary": "3D 00 6291D657DEEC24024827E69C3ABE01A30CE548A284743A445E3680D7DB5AC3AC18FF9B538D16F290AE67F760984DC6594A7C15E9716ED28DC027BECEEA1EC40A",
"crypto_context": {
"sender_private_key": "C5AA8DF43F9F837BEDB7442F31DCB7B166D38535076F094B85CE3A2E0B4458F7",
"sender_seed": "C5AA8DF43F9F837BEDB7442F31DCB7B166D38535076F094B85CE3A2E0B4458F7",
"sender_private_key": "909A8B755ED902849023A55B15C23D11BA4D7F4EC5C2F51B1325A181991EA95C6608C8666B9CDE2325F539D7D83386FE8187C6BE61D8A70C247190D64EDF5F1E",
"sender_public_key": "FC51CD8E6218A1A38DA47ED00230F0580816ED13BA3303AC5DEB911548908025",
"plaintext": "AF82"
},
"notes": "RFC 8032 Section 7.1 Test Vector 3. Signature over the two-byte message 0xAF82."
"notes": "RFC 8032 Section 7.1 Test Vector 3. sender_seed is the 32-byte RFC seed; sender_private_key is the 64-byte expanded form (a || RH) that MeshCore stores. Signature over the two-byte message 0xAF82."
}
]
}
+6 -6
View File
@@ -3,7 +3,7 @@
"name": "Group Data Payload",
"spec_ref": "src/08-payload-group.md",
"protocol_version": 0,
"description": "Tests group datagram payload. Same wire format as GRP_TXT but payload type = 0x06.",
"description": "Tests group datagram payload. Same wire format as GRP_TXT but payload type = 0x06. The encrypted plaintext is timestamp(4, LE) followed by an application-defined binary blob.",
"vectors": [
{
"id": "grp-data-001",
@@ -22,17 +22,17 @@
},
"payload": {
"channel_hash": "72",
"cipher_mac": "D184",
"ciphertext": "948C819389BA4ED7B1194A0FF8E62073"
"cipher_mac": "EFFF",
"ciphertext": "70917BC984A0AD4A409C3906B2266144"
}
},
"binary": "19 00 72 D184 948C819389BA4ED7B1194A0FF8E62073",
"binary": "19 00 72 EFFF 70917BC984A0AD4A409C3906B2266144",
"crypto_context": {
"shared_secret": "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F",
"encryption_key": "202122232425262728292A2B2C2D2E2F",
"plaintext": "47726F75704D736721"
"plaintext": "00F15365DEADBEEF0102030405"
},
"notes": "Header 0x19 = GRP_DATA(6)+FLOOD(1). Same ciphertext as GRP_TXT since same key and plaintext."
"notes": "Header 0x19 = GRP_DATA(6)+FLOOD(1). Channel hash = SHA256(channel_secret)[0] = 0x72. Inner plaintext is the GRP_DATA format: timestamp 1700000000 (00F15365 LE) + the application-defined blob DEADBEEF0102030405. 13 bytes, AES-128-ECB zero-padded to 16. AES key = first 16 bytes of channel secret; MAC = HMAC-SHA256(channel_secret, ciphertext)[0..1]."
}
]
}
+7 -7
View File
@@ -3,7 +3,7 @@
"name": "Group Text Payload",
"spec_ref": "src/08-payload-group.md",
"protocol_version": 0,
"description": "Tests group text message payload: channel_hash(1) + cipher_mac(2) + ciphertext.",
"description": "Tests group text message payload: channel_hash(1) + cipher_mac(2) + ciphertext. The encrypted plaintext is the GRP_TXT inner format: timestamp(4, LE) + flags(1) + \"<sender_name>: <body>\".",
"vectors": [
{
"id": "grp-txt-001",
@@ -22,23 +22,23 @@
},
"payload": {
"channel_hash": "72",
"cipher_mac": "D184",
"ciphertext": "948C819389BA4ED7B1194A0FF8E62073"
"cipher_mac": "EC1C",
"ciphertext": "AE220A559CFF467B8F45948C2CABFD745BB36B14426A2127BB391DBBA51DE9E5"
}
},
"binary": "15 00 72 D184 948C819389BA4ED7B1194A0FF8E62073",
"binary": "15 00 72 EC1C AE220A559CFF467B8F45948C2CABFD745BB36B14426A2127BB391DBBA51DE9E5",
"crypto_context": {
"shared_secret": "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F",
"encryption_key": "202122232425262728292A2B2C2D2E2F",
"plaintext": "47726F75704D736721"
"plaintext": "00F1536500616C6963653A2068656C6C6F206D657368"
},
"notes": "Channel hash = SHA256(channel_secret)[0] = 0x72. Plaintext 'GroupMsg!' (9 bytes). AES key = first 16 bytes of channel secret."
"notes": "Channel hash = SHA256(channel_secret)[0] = 0x72. Inner plaintext is the GRP_TXT format: timestamp 1700000000 (00F15365 LE) + flags 0x00 (TXT_TYPE_PLAIN) + the message \"alice: hello mesh\" (sender name \"alice\"). 22 bytes, AES-128-ECB zero-padded to 32. AES key = first 16 bytes of channel secret; MAC = HMAC-SHA256(channel_secret, ciphertext)[0..1]."
},
{
"id": "grp-txt-002",
"description": "Group text with tampered MAC must fail",
"type": "invalid",
"binary": "15 00 72 0000 948C819389BA4ED7B1194A0FF8E62073",
"binary": "15 00 72 0000 AE220A559CFF467B8F45948C2CABFD745BB36B14426A2127BB391DBBA51DE9E5",
"expected_error": "mac_invalid",
"notes": "Same ciphertext as grp-txt-001 but MAC zeroed. Verification must fail."
}
+10 -2
View File
@@ -329,17 +329,25 @@
"type": "object",
"additionalProperties": false,
"properties": {
"sender_seed": {
"$ref": "#/$defs/hex_string",
"description": "32-byte Ed25519 seed of sender; SHA-512-expanded and clamped to form the 64-byte private key"
},
"sender_private_key": {
"$ref": "#/$defs/hex_string",
"description": "64-byte Ed25519 private key of sender"
"description": "64-byte expanded Ed25519 private key of sender (clamped scalar a || nonce prefix RH)"
},
"sender_public_key": {
"$ref": "#/$defs/hex_string",
"description": "32-byte Ed25519 public key of sender"
},
"recipient_seed": {
"$ref": "#/$defs/hex_string",
"description": "32-byte Ed25519 seed of recipient; SHA-512-expanded and clamped to form the 64-byte private key"
},
"recipient_private_key": {
"$ref": "#/$defs/hex_string",
"description": "64-byte Ed25519 private key of recipient"
"description": "64-byte expanded Ed25519 private key of recipient (clamped scalar a || nonce prefix RH)"
},
"recipient_public_key": {
"$ref": "#/$defs/hex_string",