Uh oh!
There was an error while loading. Please reload this page.
Add padding when encrypt and remove padding when decrypt - #1545
Conversation
…` passed to `EncryptBlock` if padding is specified, no matter input is divisible or not.
…padding is specified.
…putBuffer` passed to `DecryptBlock` and unpadding for the final output if padding is not specified and mode is CFB or OFB.
…putBuffer` passed to `EncryptBlock` and unpadding for the final output if padding is not specified and mode is CFB or OFB.
Co-Authored-By: Rob Hague <5132141+Rob-Hague@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
| /// </summary> | ||
| /// <param name="input">The input.</param> | ||
| /// <returns>The padd count.</returns> | ||
| public abstract int PadCount(byte[] input); |
There was a problem hiding this comment.
We can consider replacing CipherPadding and PKCS7Padding with BouncyCastle's Pkcs7Padding
There was a problem hiding this comment.
yes, I think we should take this opportunity to delete the useless CipherPadding and replace it with BC IBlockCipherPadding, and delete PKCS7Padding and replace it with BC Pkcs7Padding, if possible
There was a problem hiding this comment.
Just had a quick look. It would be easier to remove it in my next PR #1546.
scott-xu
commented
Dec 3, 2024
There would be pros and cons about different ways to fix the issue, but anyway, I think we all agree that it is an issue and should be fixed. @Rob-Hague@zybexXL |
Rob-Hague
commented
Dec 9, 2024
I have started reviewing this, but I need more time to refamiliarise myself in this area. I have been a bit busy lately |
scott-xu
commented
Dec 9, 2024
Thanks! Reviewing is usually more difficult than DIY. No hurry, take your time. |
Uh oh!
There was an error while loading. Please reload this page.
| /// </summary> | ||
| /// <param name="input">The input.</param> | ||
| /// <returns>The padd count.</returns> | ||
| public abstract int PadCount(byte[] input); |
There was a problem hiding this comment.
yes, I think we should take this opportunity to delete the useless CipherPadding and replace it with BC IBlockCipherPadding, and delete PKCS7Padding and replace it with BC Pkcs7Padding, if possible
Uh oh!
There was an error while loading. Please reload this page.
…AesCipherTest.Gen.cs.txt Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Originally I was to use BCL TripleDES/DES to replace managed implementation. Then I found the padding is wrong and was going to make a fix. During the fix, I noticed that I'm on the same path with @Rob-Hague and @zybexXL 😄 See #1238 and https://github.com/zybexXL/SSH.NET/compare/feature_AES_CSP...zybexXL:SSH.NET:fix_padding?diff=split