C# / Windows Phone 7 - AES Encryption on WP7
You may already know that data-in-transit is secured via SSL. When calling a web service, however, the need may arise to encrypt and decrypt data. There are several cryptography algorithms on Windows Phone 7 that are supported, but we are providing a solid sample implementation using a 128-bit block size and 128-bit key size. AESManaged has a fixed block size of 128 bits and a key size of 128, 192, or 256 bits. Also, the Cipher Mode is defaulted to CBC , with a PKCS7 Padding. class AES { public static byte[] Encrypt (byte[] data, byte[] key, byte[] iv) { if (data == null || data.Length <= 0) throw new ArgumentNullException("data"); if (key == null || key.Length <= 0) throw new ArgumentNullException("key"); if (iv == null || iv.Length <= 0) throw new ArgumentNullException("key"); byte[] encrypted; using (AesManaged AESM = new AesManaged()) { /