Question:
I am using Chilkat to retrieve a public/private key pair from the local machine certificate store. However, I was wondering if it was possible to use a custom certificate store under the LocalMachine store. I want to use one of the stores that is listed in the Certificates Snap-In. For example LocalMachine/MyService. That way I can managed the import of keys and which are available to my application.
Answer:
Yes, that is possible.
You will be calling Crypt2.SetSigningCert (or Crypt2.SetVerifyCert) and passing a Chilkat.Cert object to it. You can get that Cert object from any certificate store. In your case, you would begin with the Chilkat.CreateCS object to open a specific registry-based certificate store using the CreateCS.OpenRegistryStore method:
http://www.chilkatsoft.com/refdoc/csCreateCSRef.html#method008
This returns a Chilkat.CertStore object which you can use to fetch a Chilkat.Cert object using one of the Find* methods. (http://www.chilkatsoft.com/refdoc/csCertStoreRef.html)
The trick is to determine the registry path of the certificate store you need. You might have to do some digging through the registry…