Protecting photo images that are stored on server

Hi,
We have a Net Talk application and we are allowing users to take photos of their drivers license and auto registration and insurance and they are saved as png files.
These photos are available only to the person who puts them in. However, the files are just sitting there in a folder. Should someone nefariously gain access to the server and the photos, they could potentially have access to some users’ information.

I chose not to put the pictures into a BLOB - but I could easily do that.
I can encrypt each photo - and decrypt when the user wants to view it.

QUESTION? What is the easiest and most appropriate method to protect these images?

Thanks,
Ron

the easiest w/o database changes is to put a wrapper class on the file access and then encrypt\decrypt each image and store on disk where they are. very little change to your process. you can even disguise the name by using a extn tps or yyy or what ever

Since you have Nettalk, get StringTheory and Cryptonite, a little bit of study to understand the encrypt/decrypt methods that would be appropriate for you and you should be good to go.

I think you have 2 points of concern;

Files on the disk can be accessed with the correct URL. To best protect from this i would store the files in the database as blobs.

Yes I’d store them encrypted.

I’d only display them on a form, which the user has to be logged in to see .

Always trade-offs.

Storing a lot of large blob-type stuff in a DB can slow and bloat DB backups, especially if a company retains several weeks of backups.

With storage getting more expensive, it’s worth a thought.

Hi Kevin,
What are you using to zip and unzip your files? Using pkzip or 7zip as a DOS command? I have Linderzip but it requires a window ( which I could hide in Net talk) but has a lot of unnecessary stuff.
THanks,
Ron

I did not mention anything about Zipping. I said encrypt/decript using Capesoft cryptonite.

Hi Kevin,
Thanks, I found that zipping ( with or without a password) did not decrease the size of a jpg file. I moved on to cryptonite! Thanks for your confirmation.
Ron

One possible option here, if you already own/use a reasonably recent version of NetTalk, is that NetTalk itself includes AES encryption/decryption helper functions.

For example:

enc = NetEncryptStringAES(SomeData,'password')
dec = NetDecryptStringAES(enc,'password')

From the docs this is available in at least NetTalk 11/12 and uses AES-256 encryption internally.

Interestingly, the MyTable docs also discuss “Securing Data At Rest” and note that newer versions actually prefer NetTalk over Cryptonite for hashing/AES functionality when available. The docs state:

“NetTalk can (and will be default) be used (instead of Cryptonite for Hashing and AES encryption features.) NetTalk 11.41 or later is required.”

So depending on the requirement, you may not necessarily need an additional third-party encryption product just to encrypt/decrypt image data or files.

That said, encryption mainly protects the files “at rest”, so the overall security still depends heavily on how access to the files is designed and controlled within the application itself.

So in practice the bigger protection is usually:

  • proper authentication/permissions
  • avoiding direct shared-folder access
  • serving images through the application/API
  • expiring/signed URLs or tokens
  • audit logging/watermarking if appropriate

rather than relying purely on encryption alone.

One would assume that the photo’s would also need to be backed up, so I don’t know that there is much of a gain.

Yeah.
But.
Many shops keep a lot of SQL backups. If they run a weekly DBCC CheckDB and find corruption,they may want a backup from before the corruption occurred.

Typically, one doesn’t make a bunch of backups of a file system.
If you have a dedicated hardware backup, it will normally copy the latest. And possibly keep prior versions.
But if a driver’s license photo, for example, doesn’t change, the file system backup would have no reason to keep multiple copies; whereas a database backup (unless incremental or differential) will copy the same stuff.

Additionally, SQL may, for performance reasons, get dedicated fast storage. Whereas image storage can be on a slower, cheaper system.

YMMV. There are trade-offs either way. And a lot depends on whether we’re talking about a few small BLOBs or a significant amount.

Hi All,
Thanks for the the information and discussion. I decided to store photos of Autos, owners license front and back, auto registration, auto insurance and auto inspection report in BLOBS. I take in the 2 MB+ photos( from mobile device) and size them down. I have created separate blob files for each item keyed on owner guid or auto guid. Since there will be only one valid photo of each of these for each owner or each auto, I will be able to update the blob item. Blob files are encrypted. This is all for Net Talk application. Users must be logged in and the pictures are displayed only in FORMS.
Ron

Hi Ron,
NetTalk has encryption/decryption methods that I have used as they are 100% compatible with PHP. I’m not sure if those methods can encrypt/decrypt files, I only use them for string data. But it would be easy to read the file into a string and then encrypt and save. Reverse to retrieve.

I see that Mark Sarson had commented with the encryption/decryption methods in NetTalk :slight_smile: