Re: Extracing X509 Certificate data from the Certificate Strore



This task is perhaps so easy that it appears to be difficult. You just need
to use one of the Cert* functions to obtain a CERT_CONTEXT for the
certificate (see wincrypt.h). The raw certificate that you want is in the
context's pbCertEncoded and cbCertEncoded fields.

"Frank Walker" <walker@xxxxxxxxxxx> wrote in message
news:eVflCwM$FHA.436@xxxxxxxxxxxxxxxxxxxxxxx
>I would like to use the crypto api to export a certificate from the
>certificate store, with the certificate containing only the public key. In
>other words, the private key would be stripped out. Does anybody have any
>examples on how to do this?
>
> Frank Walker
>
> ""Jeffrey Tan[MSFT]"" <v-jetan@xxxxxxxxxxxxxxxxxxxx> wrote in message
> news:lzoHFpW%23FHA.2616@xxxxxxxxxxxxxxxxxxxxxxxx
>> Hi Shankar ,
>>
>> Based on my understanding, you want to export certificate from the
>> certificate store programmatically.
>>
>> I think we can export the X.509 certificate from the store with
>> CertSerializeCertificateStoreElement API. The MSDN link below shows a
>> sample code snippet:
>> "Example C Program: Serializing Certificates"
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/s
>> ecurity/example_c_program_serializing_certificates.asp
>>
>> Hope this helps
>>
>> Best regards,
>> Jeffrey Tan
>> Microsoft Online Partner Support
>> Get Secure! - www.microsoft.com/security
>> This posting is provided "as is" with no warranties and confers no
>> rights.
>>
>
>


.



Relevant Pages

  • Re: exception " Private Key is not available" when runnig the sample "AsymmetricEncr
    ... I could find the Other People certificate store using MMC.After I reading ... Other People store and import a certificate to it. ... can you debug through the client code and the process ... > you are finding the public key to encrypt the request with. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: exception " Private Key is not available" when runnig the sample "AsymmetricEncr
    ... I could not find the Other People certificate store using MMC.After I ... can you debug through the client code and the process ... > you are finding the public key to encrypt the request with. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: Obtaining X.509 Certifcates
    ... Certmgr.exe works with two types of certificate stores: ... and CRLs from your disk to a certificate store. ... Also by default, the ASP.NET service runs under the ASPNET account, ... Set the userName attribute of the element to specify ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: Obtaining X.509 Certifcates
    ... > Certmgr.exe works with two types of certificate stores: ... > and CRLs from your disk to a certificate store. ... > In order for WSE to obtain the X.509 private key from the local ... > Also by default, the ASP.NET service runs under the ASPNET account, ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Encryption Problem
    ... SOAP messages secured by the new WSE2.0 Encryption and Digital Signature. ... key that the other end can then decrypt the message with only the public key ... certificate present in the certificate store. ... public key is not present in the certificate store then the message is ...
    (microsoft.public.dotnet.framework.webservices.enhancements)