I am testing out the idea of using .net v4's System.Security.Cryptography.ProtectedData() and UnprotectData() methods with the DataProtectionScope.LocalMachine scope to ensure that an file can only be encrypted/decrypted on a single machine. Here is the general idea of what I am doing...
//Encrypt
byte[] outBytes = ProtectedData.Protect(File.ReadAllBytes(fileIn), null, DataProtectionScope.LocalMachine);
File.WriteAllBytes(fileOut, outBytes);
//Decrypt
byte[] outBytes = ProtectedData.Unprotect(File.ReadAllBytes(fileIn), null, DataProtectionScope.LocalMachine);
File.WriteAllBytes(fileOut, outBytes);
I have done loads of testing to ensure that I get the expected behavior when doing this and it appears to work perfectly in that any user on the same machine can encrypt/decrypt a file using the method calls listed above.
My question is what will happen if someone makes a disk image or clone (using Acronis, Ghost, etc...) of a system that contains a file encrypted using this mechanism, then restores that image to a different machine? (One example being and IT department pre-loading a single system that then becomes the base image for an army of machines with identical hardware configurations). Will the restored OS on a different piece of hardware be able to decrypt the file that was encrypted on the "original" system? My hope is that because of the different hardware, the decryption will fail, but it may make sense that if all of the necessary information to do the crypto exists in the registry or on the file system, it would work.
Obviously, I could test this for myself, but I do not really have the resources to do so right now and have been searching endlessly to see if anyone else out there might already know the answer. Any advice is much appreciated!