EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Problem with ElAESSymmetricCrypto

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 09/10/2010 02:09:37
by David MICHEL (Standard support level)
Joined: 09/23/2009
Posts: 48


I noted a difference between two tools in coding. This difference poses sometimes concern on the side of the waiter which does not manage to decipher my data.

To quantify, I use the TElAESSymmetricCrypto.Encrypt function, in mode aes 128 cbc.

function TChiffrement.ChiffrementAES(fnSource, fnCleTrans: TFileName): TFileName;
  Chiffrement  : TElAESSymmetricCrypto;    //Chiffrement
  CleTransact  : TElSymmetricKeyMaterial;

  fsCleTrans   : TFileStream;
  fsSource     : TFileStream;
  fsDest       : TFileStream;

  fichDataChif : TFileName;
  fichCleTrans : TFileName;

  IV           : ByteArray;
  Key          : ByteArray;

  Chiffrement := TElAESSymmetricCrypto.Create(cmCBC); //SB_ALGORITHM_CNT_AES128
  CleTransact := TElSymmetricKeyMaterial.Create();

      fsCleTrans := TFileStream.Create(fnCleTrans, fmOpenRead or fmShareDenyWrite);

        CleTransact.Key := Key;


      CleTransact.IV := IV;


      Chiffrement.Padding     := cpNone;
      Chiffrement.KeyMaterial := CleTransact;

      fichDataChif := UFonctions.ConstructCheminDest(Copy(fnSource, 1, length(fnSource)- 6), '_2.chf');

      fsSource := TFileStream.Create(fnSource, fmOpenRead);

        fsDest := TFileStream.Create(fichDataChif, fmCreate);
          Chiffrement.Encrypt(fsSource, fsDest);


      on E : Exception do begin
        MessageDlg(E.Message, mtError, [mbOk], 0);
        Result := '';

    Result := fichDataChif;



With OpenSSL, I use the order :

OpenSSL> enc -e -in UserSignatureData_1.zip -out kk.chf -aes-128-cbc -K 21da53cd450c3a1e7b05e72582a9e0b0 -iv 0000000000000000

The result is tiny but this difference poses problem(see the attached file).

Is what this difference is normal and how to correct it.

Thanks in advance,

Sincerely yours,
Posted: 09/10/2010 02:34:06
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

Please set the Padding property to cpPKCS5. This should resolve the issue.

Chiffrement.Padding := cpPKCS5;
Posted: 09/10/2010 03:14:08
by David MICHEL (Standard support level)
Joined: 09/23/2009
Posts: 48

Indeed, this with solved my problem. There is no more difference.
I had not even thought of this parameter.

Thanks for you response,

Sincerely yours,



Topic viewed 751 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!