我想从另一个应用程序访问我的应用程序的证书存储。我已经"sharedusercertificates"
在package.appmanifest
文件中启用了。
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);
}
}
如果我尝试从其他应用程序访问它们,它将不会被列出。在 Windows Phones 8.1 的邮件客户端设置中,安装的证书也丢失了。列出了定期安装的证书,而不是以编程方式安装的证书。
有没有办法将我的自定义证书安装到系统的证书存储中?所以它可以在其他应用程序中使用。
我已经在网上搜索了几天,但我没有找到解决方案。
因此,它应该是可能的。
“sharedUserCertificates 功能授予应用程序容器读取所有用户存储和智能卡受信任根存储中包含的证书和密钥的权限。” https://msdn.microsoft.com/en-us/library/windows/apps/hh465025 .aspx
我错过了什么?帮助将不胜感激。
迪诺