How use AES/ECB/PKCS7Padding algorithm in Windows Phone 7?

☆樱花仙子☆ 提交于 2019-12-01 10:36:55

If you want to use AES/ECB/PKCS7Padding in Windows Phone, you should use Bouncy Castle library.

This library wasn't made exactly for Windows Phone, and you can't use the dll from Bouncy Castle site. Instead, you should download the WP7-ported library from here. (two links at the bottom of the article)

Now, you can use Org.BouncyCastle.Crypto.IBufferedCipher type.

cipher = CipherUtilities.GetCipher("AES/ECB/PKCS7"); // or PKCS7PADDING, no matter
cipher.Init(false, new KeyParameter(key)); // or something else

Then you should work with this variable.

And yes,

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

that's why you are getting wrong result.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!