Hi, I'm currently working on a project that stores a PDF file in a MySQL database, and then retrieves it. I can store it without problems, but I'm having difficulties when I want to get the file back from the database.
I wanted to encrypt the data just before sending it, so I used SELECT with the AES_ENCODE function provided by MySQL since I read that it's the most secure encryption for MySQL. The problem is that when I try to decrypt it I always end up with a corrupt file.
First I create a encrypted file with the data, and then I try to
decrypt it into another file. The first RijndaelManaged is only used to
create the key used to encrypt the data, and then it's later used by the second
RijndaelManaged ("SecondInstance") to decrypt.
MySQL needs a String as the encryption key, so I transform the key to base64.
The creation of the encrypted file is OK, I retrieved the PDF file without the encrypt ...
Go to the complete details ...