Let's say that we have a key exchange of some sort, which leaves A and B sharing the long-term secret $S$. Then, A and B want to use AES-CTR for the communication, which leaves us with several possible strategies:
- During the key exchange, A and B both generate and send nonces $N_a$ and $N_b$ which are mixed in the key derivation function with $S$ to produce a unique key for the exchange. We leave the IV = 0.
- During the key exchange, A and B both generate and send nonces $N_a$ and $N_b$ which are mixed to produce and IV. The key is derived from S.
- During the key exchange, A and B both generate and send $N_a$, $N'_a$, $N_b$, $N'_b$. $N_a$ and $N_b$ are mixed with $S$ to produce the key. $N'_a$ and $N'_b$ are mixed to produce the IV.
In other words: random key/fixed IV, fixed key/random IV or random key/random IV.
Which one is preferable? (Assume HMAC-SHA256 or similar for mixing keys/IV)
AES-CTR
a requirement, or could you upgrade toAES-GCM
? $\endgroup$ – roguesys Jul 9 '13 at 22:16