开发者

AES Encryption- large files

开发者 https://www.devze.com 2023-02-24 05:41 出处:网络
I am doing AES encryption using EVP interface of OpenSSL in C language in the 128/192/256 cbc modes. I found a nice example in stackoverflow with which I have started programming.

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

What I would like to know is:

  1. What is the default padding used while encryption?
  2. What happens if I have large data. Do I have to code to divide it 开发者_StackOverflowinto data blocks of 128 bits? or does EVP interface takes care of it?
  3. What should be the size of the IV for 128bit, 192bit and 256bit cbc modes(where only the key lengths are 128, 192, 256 respectively and the block size is always 128)

thanks


  1. There is no default padding for encryption. There are several padding schemes. For EVP there is an encrypt final method that takes an incomplete block and adds padding (default PKCS padding) and encrypts it.

  2. EVP will take care of it.

  3. Size of the IV vector when CBC mode is used is the same size as the block size.


You can use EVP_CIPHER_iv_length() to determine the IV size for the cipher, eg EVP_CIPHER_iv_length(EVP_aes_128_cbc()).

0

精彩评论

暂无评论...
验证码 换一张
取 消