How QtKeychain stores secret data across platforms
mainQtKeychain provides a unified Qt API for securely storing passwords and secret data. The underlying storage mechanism is automatically selected based on the operating system:
- macOS: Uses the macOS Keychain.
- Linux/Unix: Attempts to use GNOME Keyring. If unavailable, it tries KWallet (via D-Bus). It also supports libsecret.
- Windows: Uses the Windows Credential Store by default (Windows 7+).
- Note: You can disable the Credential Store by passing
-DUSE_CREDENTIAL_STORE=OFFto CMake. In this mode, it uses theCryptProtectDataWindows API to encrypt data and persists it viaQSettings.
- Note: You can disable the Credential Store by passing
- WebAssembly: Uses a transient HTML bridge to trigger the browser's native password manager (auto-fill/save prompts) and the
navigator.credentialsCredential Management API. - Android: Uses the Android Keystore system.
- iOS: Uses the iOS Keychain.
Security Note: In unsupported environments, QtKeychain will report an error rather than storing data unencrypted. To explicitly allow unencrypted storage in unsupported environments, use setInsecureFallback(true).