{"record":{"id":"b9ec9a9403a0d8d0","repo":"tursodatabase/turso","slug":"unknown-encryption-cipher-cipher","errorCode":null,"errorMessage":"Unknown encryption cipher: {cipher}","messagePattern":"Unknown encryption cipher: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/src/Turso.Data/TursoConnectionStringBuilder.cs","lineNumber":337,"sourceCode":"            : null;\n    }\n\n    internal TursoEncryptionCipher? GetEncryptionCipher()\n    {\n        var cipher = GetOption(\"Encryption Cipher\");\n        if (string.IsNullOrWhiteSpace(cipher))\n            return null;\n\n        return cipher.ToLowerInvariant() switch\n        {\n            \"aes128gcm\" => TursoEncryptionCipher.Aes128Gcm,\n            \"aes256gcm\" => TursoEncryptionCipher.Aes256Gcm,\n            \"aegis256\" => TursoEncryptionCipher.Aegis256,\n            \"aegis256x2\" => TursoEncryptionCipher.Aegis256x2,\n            \"aegis128l\" => TursoEncryptionCipher.Aegis128l,\n            \"aegis128x2\" => TursoEncryptionCipher.Aegis128x2,\n            \"aegis128x4\" => TursoEncryptionCipher.Aegis128x4,\n            _ => throw new InvalidOperationException($\"Unknown encryption cipher: {cipher}\")\n        };\n    }\n\n    private static string NormalizeKeyword(string keyword)\n    {\n        ArgumentException.ThrowIfNullOrWhiteSpace(keyword);\n        if (KeywordMap.TryGetValue(keyword, out var normalizedKeyword))\n            return normalizedKeyword;\n\n        throw new ArgumentException($\"Unsupported keyword: {keyword}\", nameof(keyword));\n    }\n\n    private string GetString(string keyword) => GetOption(keyword) ?? string.Empty;\n\n    private void SetString(string keyword, string value)\n    {\n        ArgumentNullException.ThrowIfNull(value);\n        this[keyword] = value;","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/tursodatabase/turso/blob/c1e59287258d99b309e362a63f48822256e2f65f/bindings/dotnet/src/Turso.Data/TursoConnectionStringBuilder.cs#L319-L355","documentation":"TursoConnectionStringBuilder.GetEncryptionCipher() maps the 'Encryption Cipher' connection keyword to a cipher enum and throws this InvalidOperationException for any value outside the supported list. Supported values (case-insensitive) are: aes128gcm, aes256gcm, aegis256, aegis256x2, aegis128l, aegis128x2, aegis128x4. These match the SQLCipher-compatible ciphers the embedded engine can use with 'Encryption Key'.","triggerScenarios":"Setting 'Encryption Cipher' to anything but the seven exact names — e.g. 'aes-256-gcm', 'AES256GCM128', 'chacha20poly1305', 'aes-256' — and then opening the connection or otherwise resolving options (GetEncryptionCipher is consulted when an Encryption Key is configured).","commonSituations":"Copying cipher names from SQLCipher documentation or crypto libraries that use hyphenated names ('aes-256-gcm'); assuming ChaCha20 is supported; casing or spelling drift after upgrading from another SQLite provider.","solutions":["Use one of the exact supported values: aes128gcm, aes256gcm, aegis256, aegis256x2, aegis128l, aegis128x2, aegis128x4 (any letter casing is fine).","If you do not need encryption, remove both 'Encryption Cipher' and 'Encryption Key' from the connection string.","Check for stray whitespace around the value in the connection string."],"exampleFix":"// before\nData Source=app.db;Encryption Key=secret;Encryption Cipher=aes-256-gcm\n\n// after\nData Source=app.db;Encryption Key=secret;Encryption Cipher=aes256gcm","handlingStrategy":"validation","validationCode":"private static readonly HashSet<string> ValidCiphers = new(StringComparer.OrdinalIgnoreCase)\n{ \"aes128gcm\", \"aes256gcm\", \"aegis256\", \"aegis256x2\", \"aegis128l\", \"aegis128x2\", \"aegis128x4\" };\nif (!string.IsNullOrEmpty(cipher) && !ValidCiphers.Contains(cipher))\n    throw new ConfigurationException($\"Unsupported cipher '{cipher}'. Valid: {string.Join(\", \", ValidCiphers)}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate cipher names at config load time so bad values surface at startup.","Note that hyphenated SQLCipher-style names are not accepted here."],"tags":["csharp","dotnet","connection-string","encryption","config-value"],"backgroundTag":"unsupported-config-value","analyzedSha":"c1e59287258d99b309e362a63f48822256e2f65f","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}