Help ! asymmetric encryption ?
I am trying to work out a program that will implement asymmetric encryption using CryptoAPI (C/C++ language) using digital certificates. What I want to do is use the public key from the certificate(currently PFX) to encrypt data, while use the private key to decrypt.
I started by writing a program that uses API's like CryptAcquireContext,CPGetUserkey() etc to encrypt and decrypt. However, while decrypting, I am not getting back the same program that existed before encryption.
Then I am trying out a program to do the same by extracting key information from the certificate. However, I am seeing at forums that some marshalling of public keys needs to be done to use it. Similarly, I am not being able to extract the private key from the certificate (Windows PFX).
Can you please advise me what needs to be done to get this working. Also, if you can share your code, it would be of great help.