Is it possible to NOT use the IV when implementing Rijndael decryption?

余生颓废 提交于 2021-02-07 03:54:20

问题


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?


回答1:


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).




回答2:


You can use the ECB mode and it will ignore the IV. You need an IV for other modes like CBC, though.




回答3:


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.



来源:https://stackoverflow.com/questions/7308663/is-it-possible-to-not-use-the-iv-when-implementing-rijndael-decryption

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