How to find certificate by its thumbprint in C#

后端 未结 7 776
你的背包
你的背包 2020-11-30 23:10

I am using this code to find the certificate by its thumbprint. certificate exists in certificate manager in personal certificate store but this code is not finding that cer

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 00:05

    to ensure that those LTR "\u200e" and RTL "\u200f" chars are removed from your thumbprint string do the following

    thumbprint = thumbprint.Replace("\u200e", string.Empty).Replace("\u200f", string.Empty).Replace(" ",string.Empty);
    

    the last string replace for the white space removal isnt completely necessary as it finds my certificate with or without them.

    other troublesome unicode characters can be found here

    UTF-8 encoding table and Unicode characters

提交回复
热议问题