我想從另一個應用程序訪問我的應用程序的證書存儲區。我已在package.appmanifest
文件中啓用"sharedusercertificates"
。如何訪問Windows Phone 8.1中的應用程序證書存儲運行時應用程序
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 Phone 8.1的郵件客戶端設置中,安裝的證書也丟失了。列出了定期安裝而非編程的證書。
有沒有辦法將我的自定義證書安裝到系統的證書存儲中?所以它可以用於其他應用程序。
我一直在網上搜索了幾天,但我沒有找到解決方案。
因此,應該有可能。
「的sharedUserCertificates能力授予應用程序容器讀取包含在所有用戶存儲和智能卡可信根存儲訪問的證書和密鑰。」 https://msdn.microsoft.com/en-us/library/windows/apps/hh465025.aspx
我錯過了什麼?幫助將不勝感激。
迪諾