-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message decryption relies (in part) on deserialization for validity #4138
Comments
The discretization approach in #4140 can be used here. To do so, assemble an extended message consisting of the original message length (in a platform-independent and fixed-length encoding), the original message, and arbitrary padding up to the next multiple of a globally-fixed base length. This extended message is then used for the encryption and decryption steps above. |
In case it is useful here, it's possible to use fixed nonces for both the message encryption and the signature authenticated encryption, since in honest messages the ephemeral public key used for derived encryption keys is unique. A malicious or malfunctioning sender could reuse an ephemeral key and nonce anyway in a way not detected by the recipient unless it caches previous values, so there doesn't appear to be any particular security benefit to including a random nonce. The fixed nonces can be any value; zero is easy and makes the intent clear; further, the use of proper key derivation between the two encryption operations means the nonces may be identical. |
Note that the new hashing API should be used for the key derivations proposed here. |
Fixed in: #4336 |
When a node wishes to determine if it can decrypt an incoming encrypted message, it performs several steps; these include:
If the message was not encrypted for the node:
It is possible to alter this construction such that messages not intended for a node will be rejected with less computational effort, and without relying on particular serialization formats.
To do so, the sending node does the following:
Blake2b
) with ECDH shared-secret input to produce aChaCha20
key andChaCha20-Poly1305
key, respectively:key_message = Blake2b(persona="Tari message key", input=[ECDH_shared_secret])
key_signature = Blake2b(persona="Tari signature key", input=[ECDH_shared_secret])
ChaCha20
withkey_message
ChaCha20-Poly1305
AEAD construction withkey_signature
The recipient node does the following:
Blake2b
) with ECDH shared-secret input to produce aChaCha20
key andChaCha20-Poly1305
key, respectively:key_message = Blake2b(persona="Tari message key", input=[ECDH_shared_secret])
key_signature = Blake2b(persona="Tari signature key", input=[ECDH_shared_secret])
ChaCha20-Poly1305
AEAD construction withkey_signature
ChaCha20
withkey_message
This approach adds an additional 16-byte
ChaCha20-Poly1305
tag to the message structure.This issue relates to (and in part supersedes) this issue.
The text was updated successfully, but these errors were encountered: