How to find certificate by its thumbprint in C#

后端 未结 7 754
你的背包
你的背包 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-11-30 23:53

    I did the following to remove the extra character, and also to remove anything else that's not valid hexadecimal (and ToUpper it):

                thumbprint = Regex.Replace(thumbprint.ToUpper(), @"[^0-9A-F]+", string.Empty);
    

    This allowed me to copy the thumbprint straight from the cert manager dialog and paste it straight into my usage.

提交回复
热议问题