Writing custom
openssl_encrypt() wrappers with manual IV concatenation and HMAC checks is way too easy to get subtly wrong. PHP's built-in sodium_crypto_secretbox() handles authenticated encryption in a single call and has been baked into core since PHP 7.2.commit 3c02779