Search code examples
c#monocross-platformmonogame

Is encryption in C# cross platform in mono?


Are the security encryption classes in .NET Useable on mono run times? (In particular monogame implementations that use mono run time on Mac etc.)

I am mostly interested in if I can use the [AES] (https://msdn.microsoft.com/en-us/library/system.security.cryptography.aes(v=vs.110).aspx) class because I have used it before.

Would I be able to encrypt strings (such as config data) to obfuscate it and then save that as a file and later decrypt it back in the program.


Solution

  • Yes ... you can use these classes on mono-backed platforms such as MacOS :)

    https://developer.xamarin.com/api/type/System.Security.Cryptography.Aes/

    edit: @zaph makes an excellent point in the comments ... there are libraries, such as PCLCrypto that use the native libraries on each platform for this very reason :)