Re: Reference to installed cert

From: Shawn Corey [MSFT] (shawncor_at_online.microsoft.com)
Date: 09/29/03


Date: Mon, 29 Sep 2003 13:55:35 -0700


I realized that I misworded my description of the Store.Load, I was thinking
of a different method, the Store will have access to all the certs in the
PFX not just the first one. So you may have to do a search in the PFX for
the cert you want if there are more than one certificate in the PFX. Also
the call to Store.Import I suggested should have been a Store.Add.

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Shawn Corey [MSFT]" <shawncor@online.microsoft.com> wrote in message
news:euEPnZshDHA.2408@TK2MSFTNGP12.phx.gbl...
> Store.Load will load the PFX into a temporary memory store that only
> contains the contents of the PFX, if the PFX contains more than one cert
> then CAPICOM will only use the first one encountered that has a private
key
> attached to it.
> If you wanted to copy the cert from the PFX into a normal store like the
> Current User My store then find the cert in the PFX that has a key
> associated with it and on a Store object that has had Store.Open called on
> the store you want to use then call Store.Import passing in the
certificate
> object.
> As for finding the certificate that you just imported you can use a unique
> piece of info from the cert you pulled from the PFX, such as the SHA1
hash,
> or thumbprint as it's called in the certificate object. So if you have the
> cert object then you can find the cert in the store you imported it to
with
> something like the following:
> const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0
> set oCertificates =
> oStore.Certificates.Find(CAPICOM_CERTIFICATE_FIND_SHA1_HASH,
> oCert.Thumbprint)
>
> This will return a Certificates object which has the cert you just
imported
> in it.
>
> For more info on Certificates.Find and the Store.Import methods the MSDN
has
> a good selection of samples and info
>
http://msdn.microsoft.com/library/en-us/security/Security/capicom_reference.asp
>
>
> -- 
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Johan Stäck" <johan@stack.se> wrote in message
> news:%23craWjchDHA.3104@TK2MSFTNGP11.phx.gbl...
> > Hello,
> >
> > Assume that I have just used CAPICOM   Store.Load and installed a new
> > certificate.(from a .p12 file)
> > What is the recommended way to get a reference to the new installed
cert?
> > There will normally be several certs in the store, and I wonder how can
I
> be
> > sure which one I just installed?
> >
> > Tia
> >
> > /Johan Stäck
> >
> >
>
>


Relevant Pages

  • Re: Active Directory Federation Services
    ... that is associated with their profile and the machine itself has a store. ... Just wanted to let you know that I got the cert problem fixed. ... the user certificate store. ... FSP was looking for certs in the local ...
    (microsoft.public.windows.server.active_directory)
  • Re: Issues with SSL on Win CE 5.0
    ... the HKCU certificate store. ... and tell the web server to use it. ... The old cert was in. ...
    (microsoft.public.windowsce.embedded)
  • Re: Issues with SSL on Win CE 5.0
    ... the HKCU certificate store. ... and tell the web server to use it. ... The old cert was in. ...
    (microsoft.public.windowsce.embedded)
  • Re: Issues with SSL on Win CE 5.0
    ... creating the .pfx file, the private keys need to be marked as exportable so ... the server certificate you're trying to add is present under ... and tell the web server to use it. ... The old cert was in. ...
    (microsoft.public.windowsce.embedded)
  • Re: Issues with SSL on Win CE 5.0
    ... the HKCU certificate store. ... and tell the web server to use it. ... The old cert was in. ...
    (microsoft.public.windowsce.embedded)