Re: How to get key container or public key from CertificateContext?

From: Michel Gallant (neutron_at_istar.ca)
Date: 08/12/04


Date: Thu, 12 Aug 2004 14:52:53 -0400

Hi Zheng,
There are a few ways to do that.
>From capi you can call CertGetCertificateContextProperty() with
CERT_KEY_PROV_INFO_PROP_ID and if you get a valid result, you know
that cert has a keycontainer/private key associated with it.
>From the returned PCRYPT_KEY_PROV_INFO, get the member via:
  PCRYPT_KEY_PROV_INFO ->ContainerName

Approach for .NET uses identical calls you would use in CryptoAPI.
See .NET "KeyPal" source code and function GetCertContainernames() therein:
  http://www.jensign.com/JavaScience/dotnet/keypal

- Mitch

"Lokicer" <lokicer@163.com> wrote in message news:cfg1g4$i1c$1@mail.cn99.com...
> Hi,
>
> i want to encrypt/decrypt files use certificate in store. i read the sample
> code about how to do it in .NET platform. but i still don't know how to get
> the key container or public/private key from certificate in MY store in
> VC++6.0.
> any help is appreciated,
> Thanks in advance.
>
> Zheng
>
>



Relevant Pages

  • Re: Accessing certificate store from ASP.NET web project
    ... the cert must be in the local computer/personal) store - it will then open ... Have a look at the source code to open the right cert store... ... One of the locations requires a x509 certificate in order ... different user context than my vb.net web project. ...
    (microsoft.public.dotnet.security)
  • 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
    ... the HKCU certificate store. ... and tell the web server to use it. ... The old cert was in. ...
    (microsoft.public.windowsce.embedded)