title: CertFindCertificateInStore fails to load self-signed certificates generated on different machine
body: <p>I'm trying to load a self-signed certificate generated on a different host and imported to my machine. Cert has been imported and shows up in mmc correctly. But CertFindCertificateInStore fails to load, when searched through SHA1 thumbprint.</p>
  
  <p>Here's code:</p>
  
  <pre><code>const LPWSTR    certThumbprint   = L"2af92932d0164f52b20b1ccfdf0e1e4d525fbc08";
  
  CryptStringToBinary(certThumbprint, SHA1_HASH_STRING_LENGTH,  CRYPT_STRING_HEXRAW,    NULL, &amp;dwHashDataLength, NULL,NULL);
  
  pHashData = new BYTE[dwHashDataLength];
  
  CryptStringToBinary(certThumbprint,SHA1_HASH_STRING_LENGTH,CRYPT_STRING_HEXRAW,pHashData,&amp;dwHashDataLength,NULL, NULL);
  
  hashBlob.cbData = dwHashDataLength;
  hashBlob.pbData = pHashData;
  
  if ( !(pCertContext = CertFindCertificateInStore(
      hSystemCertStore,
      X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
      0,
      CERT_FIND_SHA1_HASH,
      &amp;hashBlob,
      NULL)))
  {
      printf("\n finding cert in system store failed: %d \n", GetLastError());
      exit(-1);
  }
  </code></pre>