The best/easiest solution now is to use CAPICOM 2 functionality:
http://www.microsoft.com/downloads/release.asp?ReleaseID=44155
(unless you have very unusual requirements, in which case you may
need to use capi directly).
There are excellent samples in the CAPICOM 2 download for:
asp, c#, C++, html, vb, vbs
The CAPICOM 2 install is rather small :-) and is supported on
Win98 - XP (and also the 2.0.0.1 version seems to work in most
cases on Win95).
- Michel Gallant
MVP Security
http://home.istar.ca/~neutron
> Hello,
> I want to use the key pair of a stored X509Certificate to encrypt and
> decrypt data.
> I haven't found a solution for a few problems I have:
> Is there a way to generate a X509Certificate of a keypair in a self written
> program with the windows api?
> How can I get the private key/public key belonging to a X509 certifcate
> (stored in the windows certificate store) and decrypt/encrypt some data with
> it?
> Examples will be nice!
> I prever a solution with .NET Framework or COM (capicom.dll), but C/C++-Code
> will also fine.
> Bye
> Andreas Siglreithmayr