【问题标题】:x509store.Certificates.Find passing in string variable for object find value gives no match but hardcoded string value doesx509store.Certificates.Find 为对象查找值传入字符串变量不匹配,但硬编码字符串值不匹配
【发布时间】:2020-12-24 05:52:27
【问题描述】:

我有一个问题,当我使用传递给 Certificate.Find 方法的字符串变量调试以下代码时,我没有匹配:

string thumbprint = "1243583953004";
X509Store store = new X509Store(storeName, storeLocation);
X509Certificate2Collection certColl;
store.Open(OpenFlags.ReadOnly);
store = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);

但是当我放置一个断点并使用硬编码的字符串值运行该方法时,我得到了一个匹配项:

store = store.Certificates.Find(X509FindType.FindByThumbprint, "1243583953004", false);

我在这里遗漏了什么吗? find方法的第二个参数是对象类型。

【问题讨论】:

    标签: c# asp.net x509certificate x509certificate2


    【解决方案1】:

    我发现了我的问题。变量中有某种我看不到的控制代码。复制并重新粘贴该值后,我修复了此问题。

    【讨论】:

      猜你喜欢
      • 2017-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多