I am using CryptoAPI in VB to encrypt a string. The encryption is working very perfectly (Thanks to Davis Chapman's book).
Now the problem is to insert this string into Registry. I am using the API RegSetKeyValueEx to set the string. For eg. I want to set the String value EDate as the encrypted string. This EDate is in HKEY_LOCAL_MACHINE\SOFTWARE\Synx\ExpiryDate. The encrypted string is actually the expiry date for my activex control. In every initialize I read and decrypt this string to check the expiry date. If it has expired, my activex control locks itself and does not work untill the customer pays me for renewal. The API is not allowing me to write the Encrypted String. The .reg file is also not working. It writes simple string not the string with special characters. According to WinError.h the Error Code that returns is Access Denied (Error no 5).
Please tell me what I am doing is proper or is there a better way to do it?