Reputation: 62846
I would like to encrypt a file using my domain account credentials and check it in into the source control. I would like to have the following functionality:
I am wondering if there is anything out of the box doing what I need? If not, how would you implement such a scheme?
EDIT
Allow me to clarify. My password is not checked in into the source control. The decryption procedure should be able to use my credentials simply because I am logged in.
Motivation
The build servers needs to incorporate a certain API key into the build procedure. We do not want this API key to lay plain text in the version control. So, we have several options:
We are not seeking a bullet proof routine, after all this is all inside the private network. So, if there is a limited group of users who know the build account credentials, then they will be able to decrypt the API key. But the majority of the developers do not have the build account access and will not be able to decrypt the API key.
I am open to other suggestions.
Upvotes: 1
Views: 659
Reputation: 12915
On windows, you use the DPAPI:
https://learn.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata
For example:
import win32crypt
blob = win32crypt.CryptProtectData(data, None, None, None, None, 0)
data = win32crypt.CryptUnprotectData(blob, None, None, None, 0)
This should work fine.
Upvotes: 1