Specific requirements are as follows:
With AES encryption algorithm and the secret key for appSecret repeat twice, the offset for appSecret repeated twice (16 bit secret-key don't repeat), encryption mode CBC, filling mode; NoPadding
CodePudding user response:
Complement, Delphi7 implementationCodePudding user response:
https://download.csdn.net/download/axjlzzg/10247096? Utm_source=bbsseoConsult the
CodePudding user response:
Next is ok for your reference, and revise to
Procedure TWebAPI_JSON. AES_Decode (AKey AInPut: AnsiString. Var AOutPut: AnsiString);
Var
//v: AnsiString;
ASource of ADest: TStringStream;
AStrStream: TStringStream;
CBCKey: an array of Byte 32 [0.. 1];
//buffer: array [0..] 1024-1 Byte,
I: Integer;
The begin
Do the for I:=0 to 32-1
CBCKey: [I]=Byte (AKey [I + 1));
AStrStream:=TStringStream. Create (AInPut TEncoding. ANSI);
ASource:=TStringStream. Create (' ', TEncoding. ANSI);
ADest:=TStringStream. Create (' ', TEncoding UTF8);
Try
DecodeStream (AStrStream ASource);
AOutPut:=ASource. DataString;
//ASource. Position:=0;
//ADest. Size:=0;
//ASource. Position:=0;
ASource. Position:=0;
DecryptAESStreamECB (ASource, ASource. Size, TAESKey256 (CBCKey), ADest, pmZeroPadding);
AOutPut:=ADest. DataString;
AOutPut:=StringReplace (AOutPut, # $D# $A, ' ', [rfReplaceAll rfIgnoreCase]);//add code!!!!!!
//Writeln (' Base64='+ v);
The finally
ADest. Free;
ASource. Free;
AStrStream. Free;
end;
end;
https://sourceforge.net/projects/flyutilsencrypt/
To download the aes source