从Windows Store加载Unity证书

问题描述

我想从本地Windows证书存储区加载证书。

使用UWP,我的代码如下所示,我可以获取证书:

public static X509Certificate2 ClientCertificate()
{
    X509Certificate2 cert = null;
    X509Store store = new X509Store(StoreName.My,StoreLocation.CurrentUser);
    store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
    for (int i = 0; i < store.Certificates.Count; i++)
    {
        cert = store.Certificates[i];
        if (cert.Thumbprint == "68c8e9abc4b950a88701047af543a94c61c9ae38".toupper())
        {
            break;
        }
    }

    return cert;
}

使用Unity 2019.4时,在行store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);中收到一条错误消息,内容为: System.Security.Cryptography.CryptographicException: Store My doesn\'t exists.

我无法从本地Windows证书存储区访问证书的Unity代码在做什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)