简体   繁体   中英

Use local user login as password protection in python

I have some python (2.7) code, that connects to a DB and therefore stores the connection credentials as plaintext, which is unsecure and therefore I want to encrypt it. The code has to be run under a distinct windows user name, which has further rights (file IO etc.). The code should run unattended, so providing a password at run-time is unfeasible. I would like to use the windows user login, to authenticate the code (As in: If user 'abc' is logged in, use his credentials to decrypt the DB credentials.). Is this possible?

Bonus question: Is there a cross-plattform method to use user authentication for this kind of tasks?

you could read the credentials from a file that only the user can access...

or you could use DPAPI

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM