I'm trying to use the PHP function openssl_encrypt() to store a few short strings of data in a MySQL database.
When I test it with encrypt then decrypt in a PHP file it works fine, but if I save the data to the DB table and then SELECT it and openssl_decrypt() it, I just get gobbledygook like: ^� �Б4�
So, my guess is that the data format in DB table is corrupting the encrypted data - currently, I am doing everything in UTF-8 and saving it to a TEXT field type in the DB with a collation of utf8mb4_general_ci.
Should I change the field type in the DB table or do I need to do something to the encrypted data before inserting it? Or something else ??
Thanks for any thoughts you may have on this!