Jump to content
Hans♫

How to decrypt "EldoS AES" encrypted data on a 64 bit target?

Recommended Posts

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 by Hans♫

Share this post


Link to post

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

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.

  • Thanks 1

Share this post


Link to post
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

I am using a Delphi beta under an Embarcadero NDA, so I suppose I cannot reveal what 64 bit target it is 😉 

  • Like 1
  • Haha 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×