AES Encryption - Large Files

I am doing AES encryption using the C language EVP OpenSSL interface in 128/192/256 cbc modes. I found a good example in stackoverflow that I started programming with.

What I would like to know:

  • What is the default padding used for encryption?
  • What happens if I have big data. Do I have to code to split it into 128-bit data blocks? or will the EVP interface take care of this?
  • What should be the size IV for 128-bit, 192-bit and 256-bit cbc modes (where only the key length is 128, 192, 256, respectively, and the block size is 128).

thanks

+3
source share
2 answers
  • There is no default add-on for encryption. There are several fill patterns. For EVP, there is a final encryption method that accepts an incomplete block and adds an add-on (PKCS padding by default) and encrypts it.

  • EVP will take care of this.

  • The size of the vector IV when using the CBC mode is the same size as the block size.

0
source

You can use EVP_CIPHER_iv_length() to determine the size of the IV for encryption, for example EVP_CIPHER_iv_length(EVP_aes_128_cbc()) .

0
source

Source: https://habr.com/ru/post/972552/


All Articles