How to correctly encrypt data with proper authentication using AES-256-CBC in php?
问题 I have been using the openssl function for encrypting data with AES-256-CBC in php. I have been able to encrypt it using an unique IV (by generating with openssl_random_pseudo_bytes)for each new encryption. But I am struggling with the idea of authenticated encryption with aes cbc. How do I basically authenticate when I am about to decrypt the data? Do I need to use something like PBKDF2, blowfish or hash_hmac()? Do I need to hash the key somehow? Any help is extremely appreciated. 回答1: