PCLCrypto Rijndael

IgnacioGmez.0448IgnacioGmez.0448 UYMember
edited May 2015 in Xamarin.Forms

Hi, I am working in a Xamarin.Forms (iOS, Android & win Phone) and I need to encrypt the data.

If I could use RijndaelManaged compatible encryption that would be great since this app will be part of bigger system which uses RijndaelManaged class.

I am using the PCLCrypto nuget package and to encrypt I do the following:

public static byte[] EncryptAes(string data, string password)
        {
            byte[] key = CreateDerivedKey(password);            
            ISymmetricKeyAlgorithmProvider aes = WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesEcb);
            ICryptographicKey symetricKey = aes.CreateSymmetricKey(key);
            var bytes = WinRTCrypto.CryptographicEngine.Encrypt(symetricKey, Encoding.UTF8.GetBytes(data));
            return bytes;
        }

Now my question is, is this package compatible with RijndaelManaged class? If I encrypt something with PCLCrypt can I decrypt it with RijndaelManaged?

Answers

  • NMackayNMackay GBInsider, University mod

    @nachogsiri

    The better approach is probably to use the dependency service and do the encryption in the platform specific projects rather than the PCL.

Sign In or Register to comment.