|
Encryption
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
|
A simple trick might be to write some binary value - an indicator byte/int/long plus some indicator of the type of image that the rest of the file contains (e.g. 0xD1CEDBEE + ".JPG" for a total of 8 bytes, or 12 if you save the string as multibyte characters) - at the beginning of a new file, then stream the binary of the high-res image immediately following that byte. Save the file with a custom extension 'xxx.hires' or somesuch.
The presence of the custom header will prevent any standard software from being able to process the file as a recognized image file.
The custom app can validate the header, then create a .Net Image object from the remainder of the content in the file.
Specifying the embedded image type in the header allows for future implementations that use other file formats (which may not necessarily be images at all). If you don't like having ".JPG" in readable characters, XOR each byte of the string with some binary value, say 0x53. Just XOR them again when reading them back, to get back to the original characters.
You should probably also include a length field describing the embedded string, for flexibility, instead of assuming that it is always going to be 4 characters; I would also include a version # "just in case".
|
|
|
|
|
I'm sorry - that was a little blunt. My fault! I was going to say:
Encrypt the files - use the small file filename and some random-but-fixed data mixed together as the key and use the .NET Encryption services. Save the file with the extension ".encrypt" appended to the ".jpg" or whatever bit, and you are good to go.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Which encryption algorithm would you recommend though? There are numerous included in .NET. The one I came across that works fine is "RijndaelManaged".
|
|
|
|
|
For your situation I wouldn't go for anything too complex - All you want is something that bollixes up the simple user from getting his high-res pics for free, I assume?
Follow this[^] and you won't go too far wrong - it's pretty easy to follow, but without your key it's pretty much unbreakable. It won't stop the FBI or the mafia, but then I hope your pictures wouldn't interest either!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Yes you're completely right. While we're on the subject, would it be possible to compile all of these photos into one single encrypted package which can then only be opened by the application? That would be ideal, but if I have to store all the files separately then that's not a train smash either.
|
|
|
|
|
Yes - the encryption doesn't care what the content is. I would suggest either a simple directory structure, or just a length prefix/filename combination to each file so you can extract them from the decrypted stream.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
What you are looking for is called encryption. The photos can be in the original format (.jpg or whatever), but the files should be encrypted using a good algorithm and a strong password to keep the data protected.
You can either use some ready-to-use encryption software, or create your own program from scratch... If you decide to write your own program, see the System.Security.Cryptography namespace (there are high-quality encryption algortihms ready for you in the .NET library). There are also several articles about encryption here at CodeProject.
|
|
|
|
|
put the hi-res files inside a password-protected ZIP; or encrypt them.
|
|
|
|
|
Luc Pattyn wrote: a password-protected ZIP
very easy to copy and crack
Luc Pattyn wrote: encrypt them
better alternative.
|
|
|
|
|
You do realize that password-protecting a ZIP file is a form of encryption, right?
|
|
|
|
|
One of the weakest types of encryption, huh!
|
|
|
|
|
I don't know, is 256-bit AES encryption weak?
|
|
|
|
|
An alternate idea...
Save the high resolution images to a database on your computer. Associate a unique key to each photo, or just create a single key for an entire batch of images. Include that key(s) on the DVD with the low resolution images. When the customer gives you the DVD, use that key to lookup the high resolution pictures on your computer. The "database", "key", and "computer" can be anything you like. For example, one configuration might be:
Database: SQL Server
Key: GUID
Computer: PC
Alternate cofiguration:
Database: Excel File
Key: Customer name and date the photos were put on the DVD
Computer: DVD's with the key written on them
No need to put the data in the user's hands.
|
|
|
|
|
Store the Picture in Sqlite DataBase and lock it with password
I know nothing , I know nothing ...
|
|
|
|
|
The best way to keep secrets is to not have any. If they must come to him to have images printed anyway, why even store them on the disc? Keeping them does put the onus on the photographer for storage but I'd be surprised if doesn't already have a backup plan. It also gives the option for a client to call/email an order and have them sent.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I asked the same question The only reason I can think of is that he does not want to keep backups of all his photos.
|
|
|
|
|
Another Idea.
Leave the hi-res images as hi-res so the customer can open them and see the difference. But put distinct watermark, so when printed it does not look good.
|
|
|
|
|
Hi all,
I am trying to have my program detect when the system's memory is low. Is there an event or a windows API that I can use to achieve this?
Thanks in advance.
|
|
|
|
|
What for?
No, I don't think you can do that in a reliable way, short of actually requesting lots of memory until you aren't getting any more.
Each new version of Windows is trying harder to have all memory in use all the time, by caching everything they encounter.
|
|
|
|
|
I just need to find a way that will let me know if the OS's memory/resources is low. Is there a windows API or maybe an event in .Net that I can just plug-in to?
|
|
|
|
|
I haven't had it happen since I got more than 512MB ram, and set a decent size page file, however I recall windows pops a message for you if you are running out of memory. It would ask permission to increase the size of the page file. Leave it to Windows I say.
|
|
|
|
|
It's called try/catch . That's the best you can do. Besides, what *is* low memory in windows? It pages to disk, so you shouldn't have to worry about it.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|