Ok, doing some experiments, if I change Length(Data) to a whole number, I was able to get to 12 with no errors.
I then wrote this:
varDataLen := (Length(Data) div 2);
I made that a int64 in the var staement
The following code works:
Cipher := TDCP_rijndael.Create(nil);
Cipher.Init(Key[1], 256, @IV[1]);
SetLength(Buffer, varDataLen);
Cipher.EncryptECB(Data[1], Buffer[1]);
Cipher.Free;
ECB := Buffer;
Cipher := TDCP_rijndael.Create(nil);
Cipher.Init(Key[1], 256, @IV[1]);
SetLength(Buffer, varDataLen);
Cipher.EncryptCBC(Data[1], Buffer[1], varDataLen);
Cipher.Free;
CBC := Buffer;
When I just do the Length of Data it = 24. So 24 is too large and results in a error.
I am not sure why and what I need, but I need to encrypt this data reliably.
Funny enough, making the length 12 works and results in a ECB and CBC of 16, which is what it needed in this case, however,
other strings may be much larger. I'll have to mess with it.
Any help is appreciated.
Mike