-
Step 1
Determine if the Chilkat C++ algorithm is available on your Windows programming workstation. If it isn't, then go the World Wide Web to download it.
-
Step 2
Open Visual C++ on your programming workstation and create a new file called encrypt.cpp.
-
Step 3
Load the header files CkCrypt.2 and CkCert.h at the top of this file. This can be accomplished using the following syntax:
#include
#include -
Step 4
Create a void function called RunEncryption().
-
Step 5
Initialize a new CkCrypt2 object. The syntax for this is:
CkCrypt2 myEncrypt; -
Step 6
Establish public key encryption. Call this put_CryptAlgorithm with the following syntax:
myEncrypt.put_CryptAlgorithm("pki"); -
Step 7
Initialize a new Certificate object. Use the following syntax:
CkCert myCertificate; -
Step 8
Load your digital certificate from a file. This can be done use the LoadFromFile function. We will assume that this certificate is called sample.cert.
myCertificate.LoadFromFile("sample.cert"); -
Step 9
Encrypt the file using the CkEncryptFile function. Assume that the data you want to encrypt is in the file named fileToEncrypt.txt. Use the following syntax:
myEncrypt.CkEncryptFile("fileToEncrypt.txt"); -
Step 10
Compile encrypt.cpp in Visual C++. If the compile is successful, execute this program to test it out.








