title: How do you retrieve a list of the Local Machine Windows certificate store using Go?
body: <p>Go allows you to pretty easily retrieve the Personal Windows cert store handle for the Current User using the following command: </p>
  
  <pre><code>store, err := syscall.CertOpenSystemStore(0, syscall.StringToUTF16Ptr("MY")) // Personal Certificates
  </code></pre>
  
  <p>However, when I try to retrieve the Local Machine Personal cert store I always end up with either an empty store handle, and exception or error that the store was not found, CRYPT_E_NOT_FOUND. </p>
  
  <p>Alternatively, you can use this method:</p>
  
  <pre><code>    store, err := syscall.CertOpenStore(
         windows.CERT_STORE_PROV_SYSTEM, 
         0,
         0,
         windows.CERT_SYSTEM_STORE_CURRENT_USER,
         uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("MY")))) 
  </code></pre>
  
  <p>But when I swap out the values for the Local Machine store I start seeing the errors referenced above.</p>
  
  <p>How do you successfully retrieve the Local Machine cert store in Windows using Go?</p>