HI,
I installed the TMS Cryptography Pack component in my new Delphi 13 installation.
I’m recompiling a project developed in Delphi 10.1—which worked perfectly—to port it, and during compilation I get this error:
First chance exception at $76A34044. Exception class Exception with message 'Invalid Operation : -208'. Process MAS.exe (6436)
Below is the function I use for encryption/decryption:
function TConfiguration.DoAes(aValue: string; aCript: boolean): string;
var
lAES: TAESEncryption;
begin
// Initialize the cryptography component
lAES := TAESEncryption.create;
try
Result := '';
try
lAES.AType := atECB;
lAES.KeyLength := kl256;
lAES.Key := AESKEY;
lAES.PaddingMode := TPaddingMode.PKCS7;
lAES.IVMode := TIVMode.rand;
if aCript then
Result := lAES.Encrypt(aValue)
else
Result := lAES.Decrypt(aValue);
except
on e: exception do
begin
showmessage(e.Message);
end;
end;
finally
FreeAndNil(lAES);
end;
end;
Analyzing the code, I noticed that the function
function TAESEncryption.Decrypt(s: string; var o: string): integer;
is completely different from the one I find in the installation for Delphi 13.
The error is raised in this function:
function TAESModes.DecryptBinaryBuffer(inputBuffer: TBytes; var outputBuffer: TBytes;
** Key: TBytes; keySizeBits: integer; IVIn: boolean; IV: TBytes; padding: boolean;**
** mode: integer): integer;**
What can I do?
Thanks