AES decryption Linux |
Post Reply ![]() |
Author | |
Michael Schumann ![]() New Member ![]() Joined: 12 Jul 2018 Posts: 12 |
![]() ![]() ![]() ![]() 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!
|
|
![]() |
|
Michael Schumann ![]() New Member ![]() Joined: 12 Jul 2018 Posts: 12 |
![]() ![]() ![]() ![]() |
I forgot to add the error message I receive in Linux: "in AES the cipher text mus have a length multiple of 128 bits"
|
|
![]() |
|
Michael Schumann ![]() New Member ![]() Joined: 12 Jul 2018 Posts: 12 |
![]() ![]() ![]() ![]() |
Finally: Using hecxa as Outputformat it works on all three platforms.
|
|
![]() |
|
Michael Schumann ![]() New Member ![]() Joined: 12 Jul 2018 Posts: 12 |
![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Marion Candau ![]() Member ![]() Joined: 12 Aug 2016 Posts: 76 |
![]() ![]() ![]() ![]() |
Hi Michael, I will take a look to your issue today. Best regards, Marion
|
|
![]() |
|
Marion Candau ![]() Member ![]() Joined: 12 Aug 2016 Posts: 76 |
![]() ![]() ![]() ![]() |
Hi Michael, Your issue will be fixed in the 3.3.1.2 version that will be released soon. Best regards, Marion |
|
![]() |
Post Reply ![]() |
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |