Java icon indicating copy to clipboard operation
Java copied to clipboard

AES cipher in CBC version 1 mode

Open ojasva opened this issue 2 years ago • 6 comments

  • [x] I have read CONTRIBUTING.md.
  • [x] This pull request is all my own work -- I have not plagiarized it.
  • [x] All filenames are in PascalCase.
  • [x] All functions and variable names follow Java naming conventions.
  • [x] All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.

"Fixes #4586"

ojasva avatar Oct 03 '23 08:10 ojasva

The IV in this implementation seemingly does nothing, decrypting data seems to use a random IV instead of the actual IV used when encrypting. Have you tested this properly?

Also, is this thread safe?

0x3C50 avatar Oct 03 '23 08:10 0x3C50

The IV in this implementation seemingly does nothing, decrypting data seems to use a random IV instead of the actual IV used when encrypting. Have you tested this properly?

Also, is this thread safe?

ojasva avatar Oct 03 '23 12:10 ojasva

The IV in this implementation seemingly does nothing, decrypting data seems to use a random IV instead of the actual IV used when encrypting. Have you tested this properly? Also, is this thread safe?

  • Hey, I am sorry I closed the PR by mistake.

To quote the implementation of IV, the IV is not necessarily secret in AES-CBC. Hence, is appended with the cipher text itself. Therefore, it is not needed for decryption, which is handled by mode in the above code. I hope i answered to your query as needed. :)

ojasva avatar Oct 03 '23 12:10 ojasva

The IV in this implementation seemingly does nothing, decrypting data seems to use a random IV instead of the actual IV used when encrypting. Have you tested this properly?

Also, is this thread safe?

  • Hey, I am sorry I closed the PR by mistake.

To quote the implementation of IV, the IV is not necessarily secret in AES-CBC. Hence, is appended with the cipher text itself. Therefore, it is not needed for decryption, which is handled by mode in the above code.

I hope i answered to your query as needed. :)

The IV is integral for decrypting data in some modes. In your use case tho, it is not being passed to the Cipher at all, and acts more like a salt, being appended to the data being encrypted and thrown away once decrypted.

0x3C50 avatar Oct 03 '23 13:10 0x3C50

The IV in this implementation seemingly does nothing, decrypting data seems to use a random IV instead of the actual IV used when encrypting. Have you tested this properly?

Also, is this thread safe?

  • Hey, I am sorry I closed the PR by mistake.

To quote the implementation of IV, the IV is not necessarily secret in AES-CBC. Hence, is appended with the cipher text itself. Therefore, it is not needed for decryption, which is handled by mode in the above code. I hope i answered to your query as needed. :)

The IV is integral for decrypting data in some modes. In your use case tho, it is not being passed to the Cipher at all, and acts more like a salt, being appended to the data being encrypted and thrown away once decrypted.

That's pretty much true honestly. To my knowledge in CBC version 1, the IV was not utilized properly and hence were the further versions developed. I also plan to drop the enhanced version of the algorithm to this repository in future. I hope it'll help.

ojasva avatar Oct 03 '23 13:10 ojasva

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 04 '23 00:11 github-actions[bot]

Please reopen this pull request once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution!

github-actions[bot] avatar Jan 26 '24 00:01 github-actions[bot]