Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

AES decryption Linux

 Post Reply Post Reply
Author
Michael Schumann View Drop Down
New Member
New Member
Avatar

Joined: 12 Jul 2018
Posts: 12
Post Options Post Options   Quote Michael Schumann Quote  Post ReplyReply Direct Link To This Post Topic: AES decryption Linux
    Posted: 24 Dec 2018 at 2:44pm
I am developing a cross platform application for Windows, OSX and Linux and stubled upon an AES problem in LINUX. This code works well in both Windows and OSX but crashes on decryption in Linux. The key is 32 chars fixed in code. It is used for encrypting a DBServer password in the config file. 

function TBaseConfig.encrypt(s: string): string;
var
  aes: TAESEncryption;
begin
  aes := TAESEncryption.Create;
  aes.AType := atCBC;
  aes.KeyLength := kl256;
  aes.Unicode := noUni;
  aes.Key := APPKEY;
  aes.OutputFormat := base64;
  aes.PaddingMode := TpaddingMode.PKCS7;
  aes.IVMode := TIVMode.rand;
  result := aes.encrypt(s);
  aes.Free;
end;

function TBaseConfig.decrypt(s: string): string;
var
  aes: TAESEncryption;
begin
  aes := TAESEncryption.Create;
  aes.AType := atCBC;
  aes.KeyLength := kl256;
  aes.Unicode :=noUni;
  aes.Key := APPKEY;
  aes.outputFormat := base64;
  aes.PaddingMode := TpaddingMode.PKCS7;
  aes.IVMode := TIVMode.rand;
  result := aes.decrypt(s);
  aes.Free;
end;

Thanks for any help and merry christmas!
Back to Top
Michael Schumann View Drop Down
New Member
New Member
Avatar

Joined: 12 Jul 2018
Posts: 12
Post Options Post Options   Quote Michael Schumann Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 2018 at 3:15pm
I forgot to add the error message I receive in Linux: "in AES the cipher text mus have a length multiple of 128 bits"
Back to Top
Michael Schumann View Drop Down
New Member
New Member
Avatar

Joined: 12 Jul 2018
Posts: 12
Post Options Post Options   Quote Michael Schumann Quote  Post ReplyReply Direct Link To This Post Posted: 24 Dec 2018 at 3:19pm
Finally: Using hecxa as Outputformat it works on all three platforms.
Back to Top
Michael Schumann View Drop Down
New Member
New Member
Avatar

Joined: 12 Jul 2018
Posts: 12
Post Options Post Options   Quote Michael Schumann Quote  Post ReplyReply Direct Link To This Post Posted: 28 Dec 2018 at 11:30am
Hello, using HEXA ist no real option for me as its size is very big compared to AES64. SO I would be grateful if you could help me solving that problem. As I stated when decryptiong unter Linux using AES and base64 I get the error:

... in AES, the cipher text must have a length multiple of 128 bits!

I tried padding the base64 string to multiples of 16 characters but this did not solve the problem.

Thanks in advance and a happy new year!

Michael

Back to Top
Marion Candau View Drop Down
Member
Member
Avatar

Joined: 12 Aug 2016
Posts: 64
Post Options Post Options   Quote Marion Candau Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 2019 at 8:48am
Hi Michael,
I will take a look to your issue today.
Best regards,
Marion
Back to Top
Marion Candau View Drop Down
Member
Member
Avatar

Joined: 12 Aug 2016
Posts: 64
Post Options Post Options   Quote Marion Candau Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 2019 at 10:43am
Hi Michael,
Your issue will be fixed in the 3.3.1.2 version that will be released soon.
Best regards,
Marion
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down