Re: How To Access Public Key Certificate

From: Richard Grossman (
Date: 01/11/04

Date: Sun, 11 Jan 2004 13:04:18 +0200


I 've try the code as you've sugested.
I can't even access CERT_KEY_PROV_INFO_PROP_ID by using the function
     NULL, &dwSize)))
     MyHandleError("Error getting key property.");

Why I can only access the above properties in my public certificate:
Value returned by the function CertEnumCertificateContextProperties:

And can't get other properties like : CERT_KEY_PROV_INFO_PROP_ID

The certificate own only a public key and stored in the AdressBook
certificate store.

Please help. I'm really stuck with assymetric encryption. Is there anybody
doing here asymetric encryption without enveloped data ??

"David Miller [MSFT]" <> wrote in message
> Richard,
> You may want to review the code example at
for an example of encrypting a message using the public key of the
recipient. As the comments suggest, it is likely you would want to extend
the functionality of GetRecipientCert() to search for the specific
recipient's certificate, but this may get you started.
> Thanks,
> David
> This posting is provided "As Is" with no warranties, and confers no
> Use of included script samples are subject to the terms specified at
> ----- Richard Grossman wrote: -----
> Hi,
> I want to implement PKI in a program.
> I use only default key container of windows I mean "My", "AdressBook"
> store certificate.
> As I've understand (may be I wrong) "My" store certificate with
> key. Store AdressBook store public certificate (without private key).
> I'm trying to encrypt (asymetric a short message) using the public
> of a certifcate stored. I've tried to use the function
> CryptAcquireCertificatePrivateKey but It can't aquire context for
> certificate without private key associated.
> How can I aquire context or wich function I can call to get access to
> the handle of public key certificate?
> Thanks for help
> Richard

Relevant Pages

  • Re: Digital Signatures
    ... using a certificate for each recipient. ... certificate (public key) and the validation chain. ... Encryption and digital signing are most often used by corporations ...
  • Re: TLS-certificates and interoperability-issues sendmail / Exchange / postfix ..
    ... > to assert that certificate validation doesn't happen, ... this trusted public key store contains public keys of that the ... signed by the CA. this digital certificate is returned to the "key ...
  • RE: using certificates in Outlook for encryption
    ... public key from your certificate. ... In AD schema Outlook knows to take this from there. ... using certificates in Outlook for encryption ...
  • Re: Encrypted files -- would this work to get them back?
    ... I'm guessing it's there because you use the public key to encrypt your ... it is not very useful in cracking the encryption. ... I still might be able to recover it if it's still there. ... I was able to restore my old certificate and key but I'm stuck ...
  • Re: using certificates in Outlook for encryption
    ... using certificates in Outlook for encryption ... > they don't know what a public key is from a head gasket. ... >> from their certificate. ...