实施 Rijndael 解密时是否可以不使用 IV?
我正在使用 Rijndael 算法实现密文解密。不幸的是,我无法访问数据的加密,并且只提供了密码(用于生成密钥)和算法类型。
我没有盐(看起来没问题),也没有静脉注射。现在,我的问题是我是否绝对必须拥有 IV 才能执行解密?我怀疑编写加密的开发人员没有使用盐或IV(如果可能的话)。
我尝试将 IV 设置为 null,但没有成功,生成 Rijndael 实例会创建默认 IV,这会扭曲解密后明文的前 16 个字符。
有什么办法可以抵消IV的影响吗?或者是否需要尝试获取加密中使用的 IV?
I am implementing a decryption of ciphertext using Rijndael's algorithm. Unfortunately, I have not got access to the encryption of the data and have only been provided with a password (to generate the key with) and the type of algorithm.
I do not have a salt (which seems to be ok), and I do not have the IV. Now, my question is whether I absolutely have to have the IV in order to perform decryption? I suspect the developers who wrote the encryption made no use of salt, or IV (if this is even possible).
I have tried to set the IV to null, with no luck, and generating a Rijndael instance creates a default IV, and this is distorting the first 16 characters of my plaintext after decryption.
Is there any way to negate the effect of the IV? Or do a need to try and get hold of what IV was used in the encryption?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果密码已用于以 CBC 模式加密(是默认值)那么你必须知道 IV,没有办法绕过它。
但是,由于 IV 的用途与密码的用途不同,有时您会发现 IV 被添加到加密数据的前面(以便接收者在解密时可以轻松获取它并使用)。
If the cipher has been used to encrypt in CBC mode (which is the default) then you have to know the IV, there's no way around it.
However, since the purpose of the IV is not the same as the purpose of the password, sometimes you find the IV prepended to the encrypted data (so that the recipient can easily grab it to use when decrypting).
您可以使用 ECB 模式,它会忽略 IV。不过,对于 CBC 等其他模式,您需要 IV。
You can use the ECB mode and it will ignore the IV. You need an IV for other modes like CBC, though.
如果它是使用 IV 加密的,那么是的,您将需要 IV 才能正确解密。
从您对前 16 个字符的描述来看,您似乎正在以 CBC 模式工作。请参阅此处的图表,了解为什么需要 IV:http:// en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29。
If it was encrypted with an IV, then yes, you will need the IV in order to correctly decrypt.
From your description about the first 16 characters, it sounds like you're working in CBC mode. See the diagram here for why you'll need the IV: http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29.