How to hide Python Encryption key in Windows?

Viewed 130

I had a recent project where, using C#, I used web.config to encrypt a password and used ConfigurationManager to read (and auto-decrypt) the password from web.config. That is using a procedure much like this: https://www.codeproject.com/tips/877258/how-to-encrypt-web-config-using-aspnet-regiis-exe.

I'd like to find a native way to do the same thing with Python.

Except, when I use libraries for Python like Fernet, Cryptography, etc. the only way I see to hide a key is through secrets/environement variables but no specific way to hide a key in such a way that only Windows knows (like the aforementioned C# example). But that's something that is not a great idea since those may be accidentally exposed.

Is there a way to do this natively in Python, or, at least, using a combination of libraries (e.g. pythonnet)?

0 Answers
Related