Windows phone 8.1 如何访问app';Windows Phone 8.1运行时应用程序中的证书存储
我想从另一个应用访问我的应用的证书存储。我已经在Windows phone 8.1 如何访问app';Windows Phone 8.1运行时应用程序中的证书存储,windows-phone-8.1,certificate,smime,certificate-store,Windows Phone 8.1,Certificate,Smime,Certificate Store,我想从另一个应用访问我的应用的证书存储。我已经在包.appmanifest文件中启用了“sharedusercertificates” Windows.Storage.StorageFile selectedCertFile = await folder.GetFileAsync(fileName); IBuffer buffer = await FileIO.ReadBufferAsync(selectedCertFile); string certificateData = Cryptog
包.appmanifest
文件中启用了“sharedusercertificates”
Windows.Storage.StorageFile selectedCertFile = await folder.GetFileAsync(fileName);
IBuffer buffer = await FileIO.ReadBufferAsync(selectedCertFile);
string certificateData = CryptographicBuffer.EncodeToBase64String(buffer);
string password = "password";
await CertificateEnrollmentManager.ImportPfxDataAsync(
certificateData,
password,
ExportOption.NotExportable,
KeyProtectionLevel.ConsentWithPassword,
InstallOptions.None,
selectedCertFile.DisplayName);
在我自己的应用程序中,我可以毫无问题地列出已安装的证书:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var task = CertificateStores.FindAllAsync();
task.AsTask().Wait();
var certlist = task.GetResults();
Debug.WriteLine("Cert count: {0}", certlist.Count);
LoadCertList(certlist);
}
private void LoadCertList(IReadOnlyList<Certificate> certificateList)
{
listbox1.Items.Clear();
foreach (Certificate cert in certificateList)
{
listbox1.Items.Add(cert.Subject);
}
}
受保护的覆盖无效OnNavigatedTo(NavigationEventArgs e)
{
var task=CertificateStores.FindAllAsync();
task.AsTask().Wait();
var certlist=task.GetResults();
WriteLine(“证书计数:{0}”,certlist.count);
加载证书列表(证书列表);
}
私有void LoadCertList(IReadOnlyList certificateList)
{
listbox1.Items.Clear();
foreach(证书列表中的证书证书)
{
列表框1.Items.Add(cert.Subject);
}
}
如果我尝试从其他应用程序访问这些内容,则不会列出。
在Windows Phones 8.1的邮件客户端设置中,安装的证书也丢失。列出了定期安装而非程序安装的证书
有没有办法将自定义证书安装到系统的证书存储区?因此,它可以在其他应用程序中使用
我已经在网上搜索了好几天了,但是我没有找到解决办法
因此,这应该是可能的
“sharedUserCertificates功能授予应用程序容器对所有用户存储和智能卡可信根存储中包含的证书和密钥的读取权限。”
我错过什么了吗?非常感谢您的帮助
Dino如果您希望其他应用程序可以访问证书,则需要使用
CertificateRollmentManager.UserCertificateRollmentManager.ImportPfxDataAsync
注册它,而不是使用CertificateRollmentManager.ImportPfxDataAsync
请注意,除非共享证书已过期,否则无法删除该证书(使用InstallOptions.DeleteExpired
作为ImportPfxDataAsync
中的参数)
此外,以这种方式共享的证书越多,对证书存储的查询越慢