Type issues – winim and CryptUnprotectData

2020-06-06 Thread Neant
Hi guys. I've been trying almost the entire day to get this to work. So, I want to decrypt the local Chrome cookies, using the [CryptUnprotectData function](https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptunprotectdata) with winim. The function itself basically takes two r

Re: Type issues – winim and CryptUnprotectData

2020-06-07 Thread Ward
Interesting topic. What you do about **CryptUnprotectData** is CORRECT. The problems are: 1. You must read binary data from SQLite. 2. You need to decrypt the cookie value by AES-256 GCM mode after crhome 80. I wrote a example using [tiny_sqlite](https://github.com/GULPF/tiny_sqlite) and

Re: Type issues – winim and CryptUnprotectData

2020-06-07 Thread Neant
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

Re: Type issues – winim and CryptUnprotectData

2020-06-07 Thread Ward
> 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

Re: Type issues – winim and CryptUnprotectData

2020-06-07 Thread Neant
Shows how much I know. I actually read that page, and for reasons unknown I assumed that "[a]ny tampering results in the return of the ERROR_INVALID_DATA code" meant it would be throwing an exception... Thanks for the tip about GetLastError – I also found [this page about error codes](https://d