星期二, 10月 02, 2012

AES encryption/decryption


  • Encryption
    • openssl enc -e -in original_file -out original_file.aes -aes256 -k password
  • Decryption
    • openssl enc -d -in original_file.aes -out original_file.out -aes256 -k password

AES size: original file size + 1, then padding to 16bytes, then add 16
e.g. 1
117 bytes
117 + 1 padding to 16 bytes => 128 bytes
128 bytes + 16 = 144 bytes

e.g. 2
127 bytes
127 + 1 padding to 16 bytes => 128 bytes
128 bytes + 16 = 144 bytes

e.g. 3
128 bytes
128 + 1 padding to 16 bytes => 144 bytes
144 bytes + 16 = 160 bytes

It's irrelevant to the length of password.


沒有留言: