if I save a new credential with:
CREDENTIALW cred = { 0 };
...
cred.Type = CRED_TYPE_GENERIC;
cred.TargetName = convert("PIN");
cred.CredentialBlob = (LPBYTE)pBlob; // value here: "password"
..
BOOL ok = ::CredWriteW(&cred, 0);
...
and then received it:
PCREDENTIALW pcred;
BOOL ok = ::CredReadW(L"PIN", CRED_TYPE_GENERIC, 0, &pcred);
I can see the password in clear text. Should I encrypt/ decrypt the value CredentialBlob separately or is it also possible to encrypt the values with the Win32 API?
Thanks in advance!
You can always use a CryptProtectData and CryptUnprotectData functions pair from DPAPI to protect your data.
If your code (or any part) will be work as
SYSTEMaccount (or any service account) you need to setCRYPTPROTECT_LOCAL_MACHINEflag indwFlagsparameter: