Take a look at:
"Add security to your data with the Crypto API"
Note that Microsoft has basically abandoned the Windows CryptoAPI in favor of the .NET cryptography spaces. CAPI still works, but it is not being updated (e.g. does not have support for newer algorithms like AES), and has some issues of compatibility across OS versions, that you have to handle yourself.