Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does an equality check fail when copy/pasting certificate thumbprint strings?

I have two certificate thumbprints, retrieved from Microsoft Management Console.

When I copy/paste the values into my program, and then manually type the same values to perform an equality check, they fail.

Does anyone know why, when pasting the string value in, it doesn't pass the equality check, but when manually typing it in it does? As far as I can see, they are identical values, so shouldn't both be true?

public void DoSomething()
{
    const string thumbprint1  = "‎1F279488F131074FC7B34B9AF6E6B087678404F2";
    const string thumbprint2  = "1F279488F131074FC7B34B9AF6E6B087678404F2";

    Debug.WriteLine("thumbprint1 = {0}\n", ("1F279488F131074FC7B34B9AF6E6B087678404F2" == thumbprint1));
    Debug.WriteLine("thumbprint2 = {0}\n", ("1F279488F131074FC7B34B9AF6E6B087678404F2" == thumbprint2));
}

Here's an image of the comparison results in Visual Studio:

enter image description here


1 Answers

If you have copied and pasted thumbprints from MMC, you may find that one of the thumbprints has a special hidden character at the beginning of the thumbprint.

Press delete in front of the thumbprint to delete the hidden character, which will fix the problem.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!