EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Rijndael

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#34341
Posted: 08/31/2015 17:06:31
by Eugene Mayevski (EldoS Corp.)

Please see Ken's reply above, and that reply made me think -- can it be that you are using a precompiled version and have forgotten to set the license key? The resulting behavior will be exactly the one that you experience.


Sincerely yours
Eugene Mayevski
#34342
Posted: 08/31/2015 17:19:31
by Javier Karas (Standard support level)
Joined: 08/24/2015
Posts: 7

Quote
Ken Ivanov wrote:
Hi Javier,

I've just tried to reproduce your scenario locally and found out that my code returns exactly the same result as your 'previous delphi code' does. My code is below:

Code
var
  Crypto : TElSymmetricCrypto;
  KM : TElSymmetricKeyMaterial;
const
  KeyStr : string = '1234567890123456';
  IVStr : string = '6543210987654321';
  InputText : string = 'Test1Test1Test1';
var
  InBuf, OutBuf: ByteArray;
  OutSize : integer;
begin
  Crypto := TElSymmetricCrypto.Create(SB_ALGORITHM_CNT_AES128, cmCBC);
  KM := TElSymmetricKeyMaterial.Create();
  try
    KM.Key := BytesOfString(KeyStr);
    KM.IV := BytesOfString(IVStr);
 
    InBuf := BytesOfString(InputText);
 
    Crypto.KeyMaterial := KM;
    OutSize := Length(InBuf) * 2;
    SetLength(OutBuf, OutSize);
    Crypto.Encrypt(@InBuf[0], Length(InBuf), @OutBuf[0], OutSize);
    SetLength(OutBuf, OutSize);
 
    Writeln(BinaryToString(@OutBuf[0], OutSize));
  finally
    FreeAndNil(KM);
    FreeAndNil(Crypto);
  end;
end;


Cheers,

Ken


Thank you, the problem was my PasswordToKeyMaterial procedure, your code works perfect.

Reply

Statistics

Topic viewed 4311 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!