Initialization Vector (IV) in CBC mode for AES [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-13 07:57:13

问题


I understand the IV should be random and XORed with the plain text to start the encryption. My question is, in addition to the key, do I have to remember the random IV as well for decryption?


回答1:


The IV needs to be random, but does not need to be secret. Usual practice is to prepend the IV to the cyphertext before transmitting it. When decrypting, use the first 16 bytes of the cyphertext as the IV to decrypt the remainder. That way you do not have to store it separately, as it is included in the cyphertext.



来源:https://stackoverflow.com/questions/38928155/initialization-vector-iv-in-cbc-mode-for-aes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!