Salt in KDF #10
-
I hope it's OK to ask questions here. Thanks again for your help in previous threads. I have gone through the flow you outline here for my purposes of creating messages for a specific wallet owner. I'm wondering if it makes sense to prepend the salt for the KDF (Blake2) to the message since it's not known by the receiving party prior. For personalization, I was thinking of keeping blank as I don't think there is much benefit. Given the need to include the salt in the messages, I'm wondering if this is the correct flow for my use case which is to encrypt a message, write to a block, and then notify the wallet owner that there is a message for their consumption. If you'd prefer to discuss elsewhere, please let me know! Appreciate the discussion. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I've moved it to a discussion. Because an ephemeral key pair is being used, you don't really need a salt here. A salt is primarily needed for either a) deriving multiple subkeys from the same master key (e.g. a counter salt), b) randomness extraction in HKDF when deriving keys from a shared secret, or c) because you want to ensure a unique output despite the same input (e.g. static long-term key pairs, so a random salt). You can just specify an all-zero salt, but I would recommend specifying a personalisation (e.g. |
Beta Was this translation helpful? Give feedback.
I've moved it to a discussion.
Because an ephemeral key pair is being used, you don't really need a salt here. A salt is primarily needed for either a) deriving multiple subkeys from the same master key (e.g. a counter salt), b) randomness extraction in HKDF when deriving keys from a shared secret, or c) because you want to ensure a unique output despite the same input (e.g. static long-term key pairs, so a random salt).
You can just specify an all-zero salt, but I would recommend specifying a personalisation (e.g.
Encoding.UTF8.GetBytes("application name")
) for domain separation to your application as it's good practice.