I'm trying to protect a **local database** that contains sensitive info (similar to [this question](https://stackoverflow.com/questions/9286398/store-password-in-application), only **for delphi 2010**)

I'm using [DISQLite component](http://www.yunqa.de/delphi/doku.php/products/sqlite3/index), which does support AES encryption, but I still need to protect this password I use to decrypt & read the database.

My initial idea was to generate a random password, store it using something like DPAPI (`CryptProtectData` and `CryptUnprotectData` functions found in Crypt32.dll), but I couldn't find any example on that for Delphi

My question is: how can I safely store a randomly generated password? Or, assuming the DPAPI road is secure, how can I implement this DPAPI in Delphi?