Hans♫ 75 Posted June 11, 2019 (edited) Our software has been using the EldoS AES unit (128 bit key and ECB), to encrypt data stored locally on the users computers (binary data stored in a stream). Now on a 64 bit target, this library no longer works, but our software should still be able to read existing data on the client computers, even when it is the 64 bit edition of our software running. This leaves us with two options: 1) Make the EldoS AES encryption/decryption work with 64 bit. 2) Find another library that can decrypt existing data correctly Add 1: Did anyone convert it to work with 64 bit? It uses some pointer tricks, for example: SomeLongWordVar := PLongWord(@InBuf[0])^ to convert 4 bytes from an array of byte (InBuf) to LongWord. Not sure if that would work in 64 bit. Add 2: I quickly tried to decrypt with Lockbox 3, but get the error: "Invalid ciphertext - block padding is corrupted". Maybe I am using it wrong, but it could also be they are not compatible. Any suggestions what I could use or do to read the old encrypted data from a 64 bit application? Edited June 11, 2019 by Hans♫ Share this post Link to post
Hans♫ 75 Posted June 11, 2019 It is declared as a TAESBuffer: TAESBuffer = array [0..15] of byte; I would actually expect that trick to work on 64 bit, but I don't know. It was just an example of the code. All I can say is that the total encryption and decryption produces different results on 64 bit than on 32 bit. The reason could be very simple or very complex, but I thought I would first ask here to hear other developers experiences, before I spend more time trying find a way through. Share this post Link to post
Alexander Elagin 143 Posted June 11, 2019 I stumbled upon AES problems a month ago (using a two decades old code which worked ok) when it suddenly appeared that SizeOf(LongWord)=8 on Linux. I solved my problem by explicitly replacing LongWord -> UInt32, PLongWord -> PUInt32, array -> packed array and probably AnsiString -> RawByteString and something like this (I don't have the code at hand). At least these changes in the code helped to produce equal results in both Win32 and Linux64 versions. I do not know the internals of the Eidos implementation but probably the required changes are also minimal. 1 Share this post Link to post
Hans♫ 75 Posted June 12, 2019 10 hours ago, Alexander Elagin said: ... it suddenly appeared that SizeOf(LongWord)=8 on Linux. I solved my problem by explicitly replacing LongWord -> UInt32, PLongWord -> PUInt32, That did the trick! I searched and replaced all occurences of the text "LongWord" with "Uint32" and now it works. Thanks for the input. Share this post Link to post
David Heffernan 2345 Posted June 12, 2019 It's not clear whether you mean 64 bit Windows, or 64 bit iOS or 64 bit Linux. Share this post Link to post
Hans♫ 75 Posted June 12, 2019 I am using a Delphi beta under an Embarcadero NDA, so I suppose I cannot reveal what 64 bit target it is 😉 1 Share this post Link to post