Home > Back-end >  D7, aes - CBC - nopadding how to do
D7, aes - CBC - nopadding how to do

Time:11-02

Customer interface need to use aes encrypted text - CBC - nopadding way, could you tell me how to operate?
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 implementation

CodePudding user response:

https://download.csdn.net/download/axjlzzg/10247096? Utm_source=bbsseo
Consult 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