> I think I did manage to convert the db output to correct byte data (at least > in a few of my attempts).
Nim's string can store binary data, but std/db_sqlite cannot handle binary data well. Precisely speaking, if the BLOB data contain '0', the returned value will be truncated. > From what I can read, CryptUnprotectData is supposed to throw an > ERROR_INVALID_DATA exception if the submitted data is incorrect. Windows API don't throw any nim's exception. [Here is the document about CryptUnprotectData](https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptunprotectdata) . It just returns FALSE if the function fails, then you can use GetLastError() to get the error code.
