[英]Why can't I open a Sqlite database after setting a password using C# code?
I have a SQLite database. 我有一个SQLite数据库。 I use C# code to set its password. 我使用C#代码设置其密码。 It all goes well with no error. 一切顺利,没有错误。 However, I cannot open it using "DB Browser For Sqlite" client. 但是,我无法使用“用于Sqlite的数据库浏览器”客户端打开它。
Here is my c# code: 这是我的C#代码:
SQLiteConnection cnn = new SQLiteConnection(Config.ConnectionString);
cnn.Open();
cnn.ChangePassword(Config.DbPassword);
cnn.Close();
cnn.Dispose();
Here is the login picture: 这是登录图片:
Edit: If I use DB Browser for SQLite option "Set Encryption" then it works fine in both C# code and DB Browser for SQLite. 编辑:如果我将DB Browser用于SQLite选项“设置加密”,则它在C#代码和DB Browser对于SQLite中都可以正常工作。
For anyone else facing this issue, I turns out SQL uses "SQLCipher only recognizes 256-bit AES" according to this link: github.com/sqlitebrowser/sqlitebrowser/wiki/Encrypted-Databases and System.Data.SQLite; 对于面临此问题的其他人,我发现SQL根据此链接使用“ SQLCipher仅识别256位AES”:github.com/sqlitebrowser/sqlitebrowser/wiki/Encrypted-Databases和System.Data.SQLite; uses a different encryption. 使用不同的加密。 So if you just want to encrypt your SQLite DB then using System.Data.SQLite is does the job. 因此,如果您只想加密SQLite数据库,则使用System.Data.SQLite即可。 But if you want to specifically encrypt it with SQLCipher then use SQLitePCLRaw.bundle_sqlcipher package. 但是,如果要使用SQLCipher对其进行专门加密,请使用SQLitePCLRaw.bundle_sqlcipher程序包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.