title: Getting certificicate from decimal value serial number failed
body: <p>I am using EncryptedXml class to decrypt part of xml document.
  Within is called following .Net method :</p>
  
  <pre><code>public virtual SymmetricAlgorithm GetDecryptionKey (EncryptedData encryptedData, string symmetricAlgorithmUri) 
  </code></pre>
  
  <p>Node of xml document was encrypted with self signed certificate. 
  Here are xml key info details :</p>
  
  <pre><code>&lt;KeyInfo&gt;
   &lt;ds:X509Data xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
     &lt;ds:X509IssuerSerial&gt;
    &lt;ds:X509IssuerName&gt;CN=certName&lt;/ds:X509IssuerName&gt;
    &lt;ds:X509SerialNumber&gt;-180xxx&lt;/ds:X509SerialNumber&gt;
    &lt;/ds:X509IssuerSerial&gt;
   &lt;/ds:X509Data&gt;
  &lt;/KeyInfo&gt;
  </code></pre>
  
  <p>I have certificate properly added in LocalMachine/Personal cert store.
  When execute code I got :</p>
  
  <pre><code>System.Security.Cryptography.CryptographicException: Unable to retrieve the decryption key.
     at System.Security.Cryptography.Xml.EncryptedXml.GetDecryptionKey(EncryptedData encryptedData, String symmetricAlgorithmUri)
     at Webcom.Common.Federation.Saml.CustomEncryptedXml.GetDecryptionKey(EncryptedData encryptedData, String symmetricAlgorithmUri) in 
  </code></pre>
  
  <p>Then I reflected .Net code and found that it was executed something like this :</p>
  
  <pre><code>public static void GetFromSerial(string serialName, string serialNumber)
  {
      X509Certificate2Collection collection = new X509Certificate2Collection();
      X509Store[] stores = new X509Store[2];
      string storeName = "My";
  
      stores[0] = new X509Store(storeName, StoreLocation.CurrentUser);
      stores[1] = new X509Store(storeName, StoreLocation.LocalMachine);
  
      for (int index = 0; index &lt; stores.Length; index++)
      {
          X509Certificate2Collection filters = null;
          stores[index].Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
          filters = stores[index].Certificates;
          stores[index].Close();
          filters = filters.Find(X509FindType.FindByIssuerDistinguishedName, serialName, false);
          filters = filters.Find(X509FindType.FindBySerialNumber, serialNumber, false);
  
          if (filters != null)
              collection.AddRange(filters);
      }
  }
  </code></pre>
  
  <p>Problem is line : </p>
  
  <pre><code>filters = filters.Find(X509FindType.FindBySerialNumber, serialNumber, false);
  </code></pre>
  
  <p>For serial number that I have here I got empty collection.</p>
  
  <p>Then I converted serial number to hexadecimal value. And tried same method and it works perfectly.</p>
  
  <p>Is the problem here that I have negative big integer or something else ?
  Negative is most probably because I am using self sign certificate.</p>