简体   繁体   中英

AES Encryption in Windows Phone 7

I'm trying to implement this utility class I found on gutgames by James Craig, (you can view the class here ) with Windows Phone 7.

I had to replace all the references to System.Text.Encoding.ASCII to System.Text.Encoding.UTF8 since ASCII apparently is not supported in WP7. Besides that I'm still getting some errors because of references / namespaces not being found:

  • PasswordDeriveBytes
  • RijndaelManaged
  • CipherMode

Firstly I don't have a clue what this is, secondly, are there any classes that I can use to replace these that indeed will be available in the Windows Phone 7 framework?

Thanks!

The PasswordDeriveBytes , RijndaelManaged and CipherMode types are not implemented in Silverlight. So you need to provide your own implementation of these types.

BUT I guess that use can use AesManaged class to do what you want. From MSDN page:

The AES algorithm is essentially the Rijndael symmetric algorithm with a fixed block size and iteration count. This class functions the same way as the .NET Framework RijndaelManaged class but limits blocks to 128 bits and does not allow feedback modes.

The cipher mode is always CBC, and the padding mode is always PKCS7.

As @ie. already mentioned, these types are not included in Silverlight.

If you want to use them, you can download WP7 build of "bouncy castle library".

See this topic: Using Bouncy Castle on Windows Phone 7

The download links are at the bottom of this page. Direct link (BouncyCastle.Crypto.WP7 or BouncyCastle.Crypto.WP71)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM