I am using block cipher mode (CTR Mode) for the transmission of voice data. Need to know, how can I transfer the same IV at the decryption side (for every call) as the IV for the same packets on encryption and decryption sides must be the same.


If you encrypted your data as $c = \mathrm{CTR}_{IV}(m)$ you can send the value $IV || c$ (where $||$ is concatenation) to the decryption side. That side then parses the value it received into $IV$ and $c$ and computes $m = \mathrm{CTR}_{IV}(c)$. No need to keep the $IV$ secret.

| improve this answer | |
  • $\begingroup$ Thanks for your valuable comment. What I got till now is: IV = Nonce + Counter in CTR mode and here the Nonce will remain fixed and the counter will increase linearly for every packet. (We can say Nonce = 64bits and Counter = 64bits) So, I need to transmit the IV just once, not for every packet. Right?? Also, Can I transmit the IV as the first packet without concatenating with the ciphertext? Because I am using it for voice call so the data rate may also cause an issue if I concatenate. $\endgroup$ – Zeeshan Abbas Aug 30 '18 at 4:59
  • $\begingroup$ How you implement synchronization is up to you. What you propose makes sense, establish the nonce before you start sending data, and increment the counter for each packet you receive (assuming each packet is one block of ciphertext). Just remember, never encrypt two pieces of data with the same key and IV. $\endgroup$ – puzzlepalace Aug 30 '18 at 19:24
  • $\begingroup$ Please mention if I am wrong anywhere! The key would remain same for the whole system (i.e. for a complete call) and the IV will change for every block with the help of counter. Is it enough? For synchronization purpose, if I detect the first IV correctly then the remaining would be just incrementing linearly. $\endgroup$ – Zeeshan Abbas Aug 31 '18 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.