【发布时间】:2013-04-24 08:39:20
【问题描述】:
我需要让以下代码在 WP8 上运行,问题是 WP8 上没有 X509Certificate2 类,我尝试过使用充气城堡 API,但我还没有真正弄清楚。
有没有办法让这段代码在 WP8 上运行?
private string InitAuth(X509Certificate2 certificate, string systemId, string username, string password)
{
byte[] plainBytes = Encoding.UTF8.GetBytes(password);
var cipherB64 = string.Empty;
using (var rsa = (RSACryptoServiceProvider)certificate.PublicKey.Key)
cipherB64 = systemId + "^" + username + "^" + Convert.ToBase64String(rsa.Encrypt(plainBytes, true));
return cipherB64;
}
【问题讨论】:
标签: c# windows-phone-7 encryption windows-phone-8 windows-phone