Thank you so much for the answer!

I think I did manage to convert the db output to correct byte data (at least in 
a few of my attempts). After looking at your example and performing some 
additional tests, I **believe** that one of the the main issues I've been 
having is that CryptUnprotectData can't handle the encrypted cookie data and 
just has been returning 0 without giving me any information about whether it is 
my implementation or the submitted data that is wrong.

**Sidenote:** From what I can read, CryptUnprotectData is supposed to throw an 
ERROR_INVALID_DATA exception if the submitted data is incorrect, but I haven't 
been able to reproduce that behavior. I tried to put it in a try/except block, 
but that didn't do much.

However, I did manage to get some of my original saved code to work when I 
submit the key from Local State instead of the cookie data from the db - which 
is nice!

Anyway, your code was really helpful for me to understand what is going on. 
Also, since I'm relatively new to Nim, it's valuable to see how things are 
**supposed** to be done, rather than me just fumbling blindly towards something 
that the compiler accepts ;)

Reply via email to