How do I use CAPICOM to CREATE a certificate?
I have capicom.dll on my computer and added a reference to it in VB6 and I successfully got it working with things like HashedData and EncryptedData (works with symmetric encryption only). But to do asymmetric encryption I'm going to need to create a certificate (that is to say, I need to generate a public/private key pair). I can find all kinds of options for LOADING certificates in CAPICOM, but I can't find anything for CREATING them. And I can't find any certs on my computer that have both public and private keys, such that I could use them for experimenting with asymmetric encryption. Therefore CREATING a certificate is my only option, but I don't know how to go about it. Please help.
Re: How do I use CAPICOM to CREATE a certificate?
See Getting Ready to Use CAPICOM. Scroll down to the end.
Re: How do I use CAPICOM to CREATE a certificate?
Makecert.exe generated a certificate. This is the public key, and it will let me encrypt messages. However I need a private key to decrypt them.
How do I get the corresponding private key? I need the private key to be able to receive messages from whoever has the certificate.
Is there a way to cause makecert.exe to generate a private key? Or do I need another program to do that?
Re: How do I use CAPICOM to CREATE a certificate?
I can't find a simple cookbook description of the process or a simple code example and I don't have one to offer myself. This is probably going to require some research.
A few additional articles may help point to an answer:
The Cryptography API, or How to Keep a Secret
Extending .NET Cryptography with CAPICOM and P/Invoke - for .Net, but has useful CAPICOM info.
But all of the articles online seem to point you to the Windows SDK documentation for more details and specifics.
If you work out a functional example of the process I'm sure people would be interested in seeing it posted to the CodeBank area here.
Re: How do I use CAPICOM to CREATE a certificate?
Quote:
Originally Posted by
dilettante
I can't find a simple cookbook description of the process or a simple code example and I don't have one to offer myself. This is probably going to require some research.
A few additional articles may help point to an answer:
The Cryptography API, or How to Keep a Secret
Extending .NET Cryptography with CAPICOM and P/Invoke - for .Net, but has useful CAPICOM info.
But all of the articles online seem to point you to the Windows SDK documentation for more details and specifics.
If you work out a functional example of the process I'm sure people would be interested in seeing it posted to the CodeBank area here.
Ok, I figured how to make Makecert.exe spit out a private key along with the public key (the Certificate). So now I have 2 files, a private key and a certificate.
Now I know how to load the certificate into CAPICOM in VB6, and have already used it to encrypt some text. But now I need to know the procedure for loading the private key into CAPICOM in VB6 in order decrypt the message. Do you know of any code samples for VB6 that show's how to use CAPICOM in this way (or any other demo's of CAPICOM that have been written in VB6 that I could study to see how to use it)?