I am having an issue with MySQL AES_DECRYPT, i have no problems to use this method from mysql console directly to the server, and via MySQL workbench, however over ODBC/ADO it just does not work, i think it has something to do with the key size..
however I discovered this chilcat mysql AES decrypt, and want to give it a try, downloaded a trial and changed the demo to match my encrypted string + key but i did only get garbaged string out.. anyoe can help me to make it work ?
here is a small code i tried
procedure TForm1.Button1Click(Sender: TObject); var crypt: HCkCrypt2; success: Boolean; password: PWideChar; hexEncryptedStr: PWideChar; decryptedStr: PWideChar; begin crypt := CkCrypt2_Create(); success := CkCrypt2_UnlockComponent(crypt,'Anything for 30-day trial'); if (success <> True) then begin Memo1.Lines.Add(CkCrypt2__lastErrorText(crypt)); Exit; end; password := ' ***** Click link under for password ***** '; // Link to password under the code hexEncryptedStr := 'C4E750B566A48A0ABB76E1625CA1B6CF'; decryptedStr := CkCrypt2__mySqlAesDecrypt(crypt,hexEncryptedStr, password); Memo1.Lines.Add(decryptedStr); CkCrypt2_Dispose(crypt); end;
I would recommend first testing with a more simple password. For example, see the test vectors at this example: http://www.example-code.com/delphiDll/mysql_aes_encrypt.asp
Check to see if you can reproduce these results in MySQL workbench.
i tried with mysql a smaller key earlier over ADO, and this works, it seems the key is too long, now i heard i need to make a cipher of this key, but i dont know how to do this, encryption is ery dificult to me, if I only know how to read this as text, all would be fine
update on this one, i had the ciphers wrong, so using keyhex instead and the correct cipher your component works like a charm!
I will ask my project leader to purchase a license
would be nice anyway to know why the long 93 char password did not work tho