Commit 8bd1be5b authored by Éloïs's avatar Éloïs
Browse files

[RFC17] comment message is UTF8 encoded

parent cb927331
......@@ -34,12 +34,14 @@ Encrypt bit per bit with XOR cipher.
## Serialize encrypted message with meta data
| Prefix | Message type | Message length | Salt | Encrypted message |
|:-------:|:------------:|:--------------:|:--------:|:-----------------:|
| 2 bytes | 1 byte | 1 byte | 16 bytes | Any bytes |
| Prefix | Message type | Message length | Salt | Encrypted UTF8 message |
|:-------:|:------------:|:--------------:|:--------:|:-----------------------:|
| 2 bytes | 1 byte | 1 byte | 16 bytes | Any bytes |
The maximum length of a message is 169 bytes.
The message must be encoded in UTF8.
### Prefix
A constant value that indicates the type of format. For the present format defined in this RFC, the prefix is `0x0100`.
......@@ -61,5 +63,14 @@ A possible future format should increment the first byte of the prefix.
Encrypted message in encoded in base 64 in transaction comment directly (DUBP protocol already accept all base 64 characters).
## Decrypt transaction comment (Bob side)
1. Compute `R = beforenm(crypto_box_beforenm(Sb, Pa))`
2. Read meta data `l = Message length`
3. Read meta data `s = Salt`
4. Generate symetric encryption key `k = scrypt(R, s, N: 1024, r: 12, p: 1, dkLen: l)`
5. compute `m = encryptedMessage ^ k`
6. Interpret `m` as an UTF8 string
[crypto_box_beforenm]: https://nacl.cr.yp.to/box.html
[XOR cipher]: https://en.wikipedia.org/wiki/XOR_cipher
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment