diff options
| author | Vitor Pamplona <vitor@vitorpamplona.com> | 2023-12-29 17:40:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-29 17:40:47 -0500 |
| commit | 98d7f1cd9c2724dc963066b65b9dc681d4fe8f6f (patch) | |
| tree | fadd910486f325fe139753b2f12abf4e04ea0c8e | |
| parent | 2986982106fc10647459ad698ab12ab86cca1327 (diff) | |
| parent | 95218740e2a78dbe941f09b09360541731d8f55e (diff) | |
Merge pull request #946 from jiftechnify/patch-nip44
Fix typos of NIP-44
| -rw-r--r-- | 44.md | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -80,7 +80,7 @@ NIP-44 version 2 has the following design characteristics: | |||
| 80 | but won't leak the long-term key | 80 | but won't leak the long-term key |
| 81 | 3. Calculate message keys | 81 | 3. Calculate message keys |
| 82 | - The keys are generated from `conversation_key` and `nonce`. Validate that both are 32 bytes long | 82 | - The keys are generated from `conversation_key` and `nonce`. Validate that both are 32 bytes long |
| 83 | - Use HKDF-expand, with sha256, `OKM=conversation_key`, `info=nonce` and `L=76` | 83 | - Use HKDF-expand, with sha256, `PRK=conversation_key`, `info=nonce` and `L=76` |
| 84 | - Slice 76-byte HKDF output into: `chacha_key` (bytes 0..32), `chacha_nonce` (bytes 32..44), `hmac_key` (bytes 44..76) | 84 | - Slice 76-byte HKDF output into: `chacha_key` (bytes 0..32), `chacha_nonce` (bytes 32..44), `hmac_key` (bytes 44..76) |
| 85 | 4. Add padding | 85 | 4. Add padding |
| 86 | - Content must be encoded from UTF-8 into byte array | 86 | - Content must be encoded from UTF-8 into byte array |
| @@ -115,9 +115,9 @@ validation rules, refer to BIP-340. | |||
| 115 | - Validate length of base64 message to prevent DoS on base64 decoder: it can be in range from 132 to 87472 chars | 115 | - Validate length of base64 message to prevent DoS on base64 decoder: it can be in range from 132 to 87472 chars |
| 116 | - Validate length of decoded message to verify output of the decoder: it can be in range from 99 to 65603 bytes | 116 | - Validate length of decoded message to verify output of the decoder: it can be in range from 99 to 65603 bytes |
| 117 | 3. Calculate conversation key | 117 | 3. Calculate conversation key |
| 118 | - See step 1 of (encryption)[#Encryption] | 118 | - See step 1 of [encryption](#Encryption) |
| 119 | 4. Calculate message keys | 119 | 4. Calculate message keys |
| 120 | - See step 3 of (encryption)[#Encryption] | 120 | - See step 3 of [encryption](#Encryption) |
| 121 | 5. Calculate MAC (message authentication code) with AAD and compare | 121 | 5. Calculate MAC (message authentication code) with AAD and compare |
| 122 | - Stop and throw an error if MAC doesn't match the decoded one from step 2 | 122 | - Stop and throw an error if MAC doesn't match the decoded one from step 2 |
| 123 | - Use constant-time comparison algorithm | 123 | - Use constant-time comparison algorithm |
| @@ -126,7 +126,7 @@ validation rules, refer to BIP-340. | |||
| 126 | 7. Remove padding | 126 | 7. Remove padding |
| 127 | - Read the first two BE bytes of plaintext that correspond to plaintext length | 127 | - Read the first two BE bytes of plaintext that correspond to plaintext length |
| 128 | - Verify that the length of sliced plaintext matches the value of the two BE bytes | 128 | - Verify that the length of sliced plaintext matches the value of the two BE bytes |
| 129 | - Verify that calculated padding from step 3 of the (encryption)[#Encryption] process matches the actual padding | 129 | - Verify that calculated padding from step 3 of the [encryption](#Encryption) process matches the actual padding |
| 130 | 130 | ||
| 131 | ### Details | 131 | ### Details |
| 132 | 132 | ||
| @@ -291,5 +291,5 @@ The file also contains intermediate values. A quick guidance with regards to its | |||
| 291 | - `valid.encrypt_decrypt`: emulate real conversation. Calculate pub2 from sec2, verify conversation_key from (sec1, pub2), encrypt, verify payload, then calculate pub1 from sec1, verify conversation_key from (sec2, pub1), decrypt, verify plaintext. | 291 | - `valid.encrypt_decrypt`: emulate real conversation. Calculate pub2 from sec2, verify conversation_key from (sec1, pub2), encrypt, verify payload, then calculate pub1 from sec1, verify conversation_key from (sec2, pub1), decrypt, verify plaintext. |
| 292 | - `valid.encrypt_decrypt_long_msg`: same as previous step, but instead of a full plaintext and payload, their checksum is provided. | 292 | - `valid.encrypt_decrypt_long_msg`: same as previous step, but instead of a full plaintext and payload, their checksum is provided. |
| 293 | - `invalid.encrypt_msg_lengths` | 293 | - `invalid.encrypt_msg_lengths` |
| 294 | - `invalid.get_conversation_key`: calculating converastion_key must throw an error | 294 | - `invalid.get_conversation_key`: calculating conversation_key must throw an error |
| 295 | - `invalid.decrypt`: decrypting message content must throw an error | 295 | - `invalid.decrypt`: decrypting message content must throw an error |