Hi
I have difficulties to encrypted a text with AES whereas I follow method presented in your demo
Notice than to decrypt I successed
Please find a project to demonstrate the problem
Reg
Crypto.zip (8.5 KB)
ards
Hi
I have difficulties to encrypted a text with AES whereas I follow method presented in your demo
Notice than to decrypt I successed
Please find a project to demonstrate the problem
Reg
Crypto.zip (8.5 KB)
ards
Hi Olivier,
There are a couple of solutions to fix this and here is one that encrypts (I haven’t tested a lot):
FUNCTION TForm1.Cryptage( Crypte: Boolean; CONST Cle: STRING; VAR Valeur: STRING ): Boolean;
VAR
AES: TAESEncryption;
Resultat, s: STRING;
Id_Erreur: Integer;
Conv: TConvert;
BEGIN
Result := True;
AES := TAESEncryption.Create();
TRY
Conv := TConvert.Create(base64); // use TConvert
TRY
AES.AType := atCBC;
AES.KeyLength := kl256;
s := 'pWaSKdx30ac3GqFnHRuSJcVpG0fMTuNzRdsQYHRxMaI='; // B9CF8CEEE40A23572AD972CCAA3D7CBE
s := Conv.FormatToChar(s);
AES.key := s; // 'pWaSKdx30ac3GqFnHRuSJcVpG0fMTuNzRdsQYHRxMaI='; B9CF8CEEE40A23572AD972CCAA3D7CBE
Now AES.inputFormat := raw is correct.
Regards,
bernard
Thanks for your VERY quick answer
I use this :
s := 'pWaSKdx30ac3GqFnHRuSJcVpG0fMTuNzRdsQYHRxMaI='; // B9CF8CEEE40A23572AD972CCAA3D7CBE
s := Conv.FormatToChar(s);
but I always receive this error when “s := Conv.FormatToChar(s);” occurs
Le projet Crypto.exe a déclenché la classe d'exception ECryptoPack avec le message 'Bad Type (255)'.
With Conv created like above?
Forget it
I didn’t see this line
Conv := TConvert.Create(base64); // use TConvert
and now it works
Sorry
olivier
No harm. Standard conversion issue.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.