Reputation: 21
I'm writing a mobile application using Microsoft Visual Studio 2008 and need to encrypt a file. I tried to use a File.Encrypt
method but it resulted in following error:
error CS0117: 'System.IO.File' does not contain a definition for 'Encrypt'.
How can I cope with this problem?
Upvotes: 2
Views: 1687
Reputation: 3654
File.Encrypt
does not exist within the mobile .NET runtime.
Try using the ProtectedData
class.
Upvotes: 1
Reputation: 16934
The reason it won't work is because File.Encrypt
actually calls the native Win32 function EncryptFile(LPSTR path)
, which won't be present on a mobile device.
My suggestion as an alternative would be to use the encryption algorithms present in the System.Security.Cryptography
namespace.
Upvotes: 8