AES algorithm. The Group length is 128 bits, and the key length can be 128, 192, or 256 bits.
Aes_128_cbc(Cipher Block Chaining)
1,The total number of bits in the plaintext must be a multiple of the block size, 128bit.
Encryption is to encrypt and splice each segment, and add IV to the header. The input includes AES key, IV, plaintext | padding, and the output is ciphertext;
During decryption, the input includes AES key, IV, and ciphertext, and the output is plaintext.
2,CBC encryption: C1 =Ciphk(P1 limit IV );
Cj =Ciphk(PJ platinum Cj-1) for J = 2... N.
CBC decryption: p1 =CIPH-1K(C1) Certificate IV;
PJ =Ciph-1 K(CJ) Fill Cj-1 for J = 2... N
Wherein, the IV value is 128 bits, and its generation reference is sp800-38a.pdf, P2;
For details about padding, refer to "sp800-38a.pdf" p24 and "RFC 2630;
Ciphk refers to the aes128 encryption function, and ciph-1 K refers to the aes128 decryption function.
3,Illustration
Please refer to "sp800-38a.pdf" P17.
Aes_128_ctr(Counter)
1. The total number of bits in the message is (n-1) B + u, where 1 ≤ U ≤ B.
Encryption is the encryption and splicing of each segment, and the initial counter is added to the header. The input includes AES key, initial counter, and plaintext. The output is ciphertext;
During decryption, the input includes AES key, initial counter, and ciphertext, and the output is plaintext.
2. CTR encryption: OJ =Ciphk(TJ) for j = 1, 2... N;
Cj = PJ export OJ for j = 1, 2... N-1;
C * n = p * n recordsMSBU (on ).
CTR decryption: OJ =Ciphk(TJ) for j = 1, 2... N;
PJ = CJ semantic OJ for j = 1, 2... N-1;
P * n = C * n recordsMSBU (on ).
Initial counter, that is, T1 is 128 bits, and its generation reference is sp800-38a.pdf, P26;
T2...... TN is generated through the incrementing function. For details, refer to 《sp800-38a.pdf "P25, which is actually to add 1 to the original base;
Ciphk refers to the aes128 encryption function;
MSB refers to the most significant bit.
3. Illustration
Please refer to "sp800-38a.pdf" P23.
Everything in this article is summarized from 《Sp800-38a.pdf.