C# FindBySubjectName 函数

标签 c# security find certificate x509certificate

为什么:

foundCertificates = certificates.Find(X509FindType.FindBySubjectName, "TEXT 14", false);

查找与

相同的证书
foundCertificates = certificates.Find(X509FindType.FindBySubjectName, "TEXT 141", false);

如果我指定我想要“TEXT 141”,它不应该为我选择“TEXT 14”。

我该如何解决?

最佳答案

来自documentation对于 X509FindType.FindBySubjectName 枚举成员:

Using the FindBySubjectName value, the Find method performs a case-insensitive string comparison using the supplied value. For example, if you pass "MyCert" to the Find method, it will find all certificates with the subject name containing that string, regardless of other subject values. Searching by distinguished name is a more precise search.

因此,如果您想要精确匹配,请改用 X509FindType.FindBySubjectDistinguishedName

关于C# FindBySubjectName 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32633558/

相关文章:

asp.net-mvc - ASP.NET MVC 安全建议

.net - HttpWebRequest 似乎没有发送客户端 SSL 证书

Windows bat脚本查找替换文件夹和子文件夹中的每个文件

Delphi:TStringList.Contains?

c# - vb 中的枚举错误,它与 c# 中的枚举有何不同?

c# - 发布到 IIS 7.5 时出现 ASP.NET Core 404 错误

c# - const 字段是否在编译时转换为静态字段?

c# - Unity [Depedency] Annotation 本身不是一个依赖吗?

java - Spring Security - 存储库 SocialUser

linux - linux中find和sed命令的错误?