AES的CBC模式下的初始化向量(IV) [英] Initialization Vector (IV) in CBC mode for AES

查看:2223
本文介绍了AES的CBC模式下的初始化向量(IV)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道IV应该是随机的,并与纯文本进行XOR运算以开始加密。我的问题是,除了密钥外,我还必须记住随机IV进行解密吗?

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?

推荐答案

IV需要是随机的,但不必是秘密的。通常的做法是在传输密文之前将IV放在密文之前。解密时,请使用密文的前16个字节作为IV来解密其余部分。这样,您不必将其单独存储,因为它包含在密文中。

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.

这篇关于AES的CBC模式下的初始化向量(IV)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆