You are not logged in.
Hi,
I am trying to decrypt a rijndael encrypted piece of data that is encrypted with DCPcrypt2's encryptCBC function, using mormot2's TAescbc with the following code:
var dat,test,dIV:array of byte; i:cardinal
begin
e:=TAescbc.Create(mkey,128);
e.IV:=PHash128(@dIV[8])^;
i:=length(dat)
setlength(test,i);
e.Decrypt(dat,test,i);
e.Free;
What I notice is that even if I put the same data in mkey, dIV, dat, I am getting every time it runs different results in "test"
Am I missing something?
Thank you in advance
Last edited by dcoun (2021-04-19 14:12:09)
Offline
My guess is that you are confusing the mkey "var" parameter.
mkey should be a memory buffer - if you pass a string here you will hash the pointer to the string, not the string itself.
Try to use mkey[1] for a string.
Offline
I apologize. Mkey is tbytes And it worked as it follows:
e:=TAescbc.Create(mkey[0],128);
Thank you a lot
Last edited by dcoun (2021-04-19 15:29:24)
Offline