EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How to encrypt AES 128 ECB with key

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
Posted: 08/09/2016 14:55:27
by Bremen Sistemas (Basic support level)
Joined: 08/20/2012
Posts: 17

procedure TForm1.Button4Click(Sender: TObject);
  Crypto: TElAESSymmetricCrypto;
  keyM: TElSymmetricKeyMaterial;
  KeyBuf,InBuf,OutBuf: ByteArray;
  OutSize: integer;
  IV : ByteArray;

  mykey: string;
  mykey := 'hFPcpNFQ8JQhmJ/idIngQg==';        // normal
  //mykey := 'aEZQY3BORlE4SlFobUovaWRJbmdRZz09';  // base64

  Crypto         := TElAESSymmetricCrypto.Create(SB_ALGORITHM_CNT_AES128, cmECB);
  //Crypto.Padding := cpPKCS5;

  keyM   := TElSymmetricKeyMaterial.Create;

    SetLength(IV, 16);
    IV:= SBUtils.BytesOfString(Copy(Edit1.Text,1,16));
    Key.IV := IV;
    KeyBuf := SBUtils.BytesOfString(Edit1.Text);
    Key.Key:= KeyBuf;
    aes.Padding := cpNone;
    aes.KeyMaterial := Key;

   // aes.Mode :=

    InBuf := SBUtils.BytesOfString(Edit2.Text);
    OutSize := 0;
    aes.Encrypt(@InBuf[0], Length(InBuf), nil, OutSize);
    SetLength(OutBuf, OutSize);
    aes.Encrypt(@InBuf[0], Length(InBuf), @OutBuf[0], OutSize);
    SetLength(OutBuf, OutSize);
    // convert binary output to Base64 to make it readable
    Memo1.Text := SBEncoding.Base64EncodeArray(OutBuf, false);

How to encrypt AES 128, with 16bits, if my "mykey" is size 24 ?
Posted: 08/09/2016 15:07:50
by Eugene Mayevski (EldoS Corp.)

Technical Support is provided to customers with the linked Support Access Ticket. You will find your Support Access Ticket together with all the details about how to use it in the registration e-mail that we’ve sent to you upon the purchase. The procedure of linking the Support Access Ticket is described in the registration e-mail as well.

I am afraid that without the Support Access Ticket linked we won't be able to assist you. Thank you for understanding.

Sincerely yours
Eugene Mayevski



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