login about faq

hi!

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;

Password Link

asked Apr 11 '13 at 02:48

plastkort's gravatar image

plastkort
1113

edited Apr 11 '13 at 02:49


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.

link

answered Apr 11 '13 at 10:09

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

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

link

answered Apr 11 '13 at 13:40

plastkort's gravatar image

plastkort
1113

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

link

answered Apr 12 '13 at 06:30

plastkort's gravatar image

plastkort
1113

would be nice anyway to know why the long 93 char password did not work tho

link

answered Apr 12 '13 at 06:30

plastkort's gravatar image

plastkort
1113

1

I don't know why the longer password wouldn't work. The MySQL algorithm to transform the password string to a 128-bit AES secret key is simple and there is no limitation on the password length. You might check to see if it's somehow not the length that causes the problem, but specific chars within that 93-char password. In other words, try a long password with A-Za-z0-9 chars only and see if that works.

(Apr 12 '13 at 08:30) chilkat ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×64
×56
×33
×3

Asked: Apr 11 '13 at 02:48

Seen: 5,599 times

Last updated: Apr 12 '13 at 08:30

powered by OSQA