I am testing the idea of using the .net v4 System.Security.Cryptography.ProtectedData () and UnprotectData () methods with the DataProtectionScope.LocalMachine scope to ensure that a file can only be encrypted / decrypted on one machine. Here is a general idea of what I'm 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 many tests to make sure I get the expected behavior with this, and it seems to work just fine in the sense that any user on one computer can encrypt / decrypt a file using the method calls listed above.
My question is what happens if someone makes a disk image or clones (using Acronis, Ghost, etc.) a system that contains a file encrypted using this mechanism and then restores this image to another computer? (One example is the IT department preloading one system, which then becomes the base image for an army of vehicles with identical equipment configurations). Will the recovered OS on other hardware decrypt the file that was encrypted in the "original" system? I hope that due to various equipment, decryption will fail, but it may make sense that if all the necessary information for cryptography exists in the registry or in the file system, it will work.
Obviously, I could check it out for myself, but I don’t have the resources to do it right now, and we have been searching endlessly to find out if anyone else can find out the answer. Any advice is greatly appreciated!
Christian
source share