.NET MAUI › Local Storage & Data

How do you protect data at rest in a MAUI app?

Advanced

Answer

Keep secrets in SecureStorage (keystore-backed). For databases, use SQLCipher (via sqlite-net's encryption support) to encrypt the file, storing the key in SecureStorage. Avoid logging sensitive data, and prefer platform biometric gating for access. Never hardcode keys in the app package.
// Encrypted SQLite connection string (SQLCipher)
var options = new SQLiteConnectionString(dbPath, true,
    key: await SecureStorage.Default.GetAsync("db_key"));
var db = new SQLiteAsyncConnection(options);
Real-world example A healthcare app encrypts its local SQLite database with a key held in the OS keychain to meet compliance requirements.

Common follow-ups: Where do you store the encryption key? | Why avoid hardcoding keys?