user3731783
user3731783

Reputation: 718

Find X509 certificate from store based on Thumbprint

I am trying to find a certificate from store using its Thumbprint. I am having very hard time to find what is the problem with my code. See the image

Top section shows my code with debugger stopped at that position. Then I have copied that statement into Immediate Window and the count is zero.

There are two certificates in the location that I am trying to find and second certificate is what i am interested in. So I have modified the statement to use the thumbprint of that certificate rather than typing it manually in. Now the count is 1.

Then I just printed Thumbprint and copied to previous statement and count is 1. So I thought there is a typo. but I you see the last two statements, there is no typo. only difference is spaces, which does not matter. But I tried making both statements look exactly same but result always differ.

Not sure what is going on... either i am missing very simple thing or i am too stupid.

Upvotes: 0

Views: 398

Answers (1)

tia
tia

Reputation: 9698

Your original string might contain invisible Unicode characters. If the thumbprint string from Certificate[1].Thumbprint works fine, copy it from debug window and use that one instead.

Upvotes: 2

Related Questions