>
>>Craig,
>>>
>>>Alex Feldstein recommended me to use your VFPEncryption.FLL for encryption/decryption. I download the zip and read the documentation. It works great! However, I do have one question. When I decrypt it with the wrong key, the function doesn't throw any exception or SetLastError, how do I determine whether a wrong key is entered? In other words, how do I know it decrypted correctly?
>>
>>Just an idea: why don't you also store a known string, and decrypt it? If it doesn't match the expected string, the key is wrong. You could use something that won't change, like your name, or name of the exe.>
>Another idea could be to inspect the first few bytes returned. Look to see if it is a bunch of gibberish (iow high-ascii chars instead of -mostly- ascii 32 to 122).
Yes, that'd be a "known string" - in the case we expect the string to be ASCII text. If there's more than a dozen unprintable characters in first, say, 80 bytes of the decrypted string, sorry, wrong key... try knocking at the door, maybe there's someone inside.