am trying to protect bytes data using the protectedmemory and protecteddata in .net application
form this site, http://www.codedigest.com/Articles/Framework/69_Data_Encryption_and_Decryption_using_DPAPI_classes_in_NET.aspx
is seems i can only protect a few bytes
and also, i cannot get the sample provided here http://msdn.microsoft.com/en-us/library/ms229741(v=vs.85).aspx to run
I get the following errors:
Name ‘MemoryProtectionScope’ is not declared. (BC30451)
Name ‘DataProtectionScope’ is not declared. (BC30451)
Name ‘ProtectedMemory’ is not declared. (BC30451)
can anyone help me with other methods of doing this.
What makes you think that you can only protect a few bytes from that article ? The API is quite simple – remember that the encryption doesn’t happen in place, a new array is returned with the encrypted content.
Here is a full example of using
ProtectedData.Protectand back:Also, you will need to add a reference to the System.Security assembly.