Function mosaic::dpapi_encrypt#

Function Documentation#

QString mosaic::dpapi_encrypt(const QString &plaintext)#

Encrypts plaintext for storage in a JSON settings file, using Windows DPAPI (CryptProtectData, current-user scope) on Windows builds.

Returns a "dpapi:v1:<base64>" marker string on success. Returns plaintext unchanged (with a logged warning) if DPAPI itself fails, and on non-Windows builds (a plain pass-through, since DPAPI is Windows-only) — never silently drops the value, just leaves it unprotected rather than lose it. An empty string returns an empty string (nothing to protect).

See also

dpapi_decrypt