Which method is safer and faster for file encryption?

I have a requirement to upload medical files and encrypt them

Should I use this method :  (filestream)

OR should I encrypt the file in the code, like this:

-- As far as safety and speed, which one is better? I'm thinking if I use "filestream", I still need to encrypt the file. Would the file get corrupted?
Who is Participating?
masterpassConnect With a Mentor Commented:
The first method is just a standard method to store the file to the DB .. If you need to use the encryption, then you willl need to employ method two with method 1

hope this helps!
Ephraim WangoyaConnect With a Mentor Commented:
Use the FileStream to store the files but Encrypt the data before saving it.

Similarly to retrieve the data, retrieve from the FileStream, then Decrypt it before display
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.