DES implementation (off by one?)
Hi,
I need to use CBC-DES with an all zeroes key for the reason of changing key from using DES to AES on Mifare DESFire. Neither Microsoft's implementation or bouncycastle allows this, and since I did not find anyone having done the cbc part in C# online, I am more or less implementing it on my own with the help of auxiliary methods licensed under MIT that I did find on github (no CBC support however)
I did get it working this morning for a one block size, but when trying to fix the chaining I made some change that I can't remember and now I get almost-but-not-quite the expected value when encrypting even one block. Unfortunately I had not checked it in either before I started doing that. Maybe I am missing something obvious, either way, a fresh set of eyes would be very helpful.
Attached is an MRP. Running it gives this input:
I am using a non-zero key for this to be able to compare with MS' implementation. As you can see, decrypting the data encrypted using MS gives the right value, but encrypting seems slightly, increasingly, off.
Thanks in advance.
0 Replies