SQLite连接字符串具有加密的密码 [英] Sqlite connection string with encrypted password
问题描述
我有一个使用"SQLite Cipher" 的加密数据库.当我尝试使用连接字符串连接到数据库时,出现以下错误消息:
'SQL逻辑错误不能使用'Password'连接字符串属性:库不是使用加密支持构建的.'
导入System.Data.SQLite公共类frm_projects昏暗的dtset作为新的SQLiteConnection("Data Source = Setting.db; Password = m;")私有子目录frm_projects_Load(作为对象发送,作为EventArgs发送)处理MyBase.Load尝试如果dtset.State = ConnectionState.Closed然后dtset.Open()万一异常捕获MsgBox(例如消息,MsgBoxStyle.Information,警告")结束尝试结束子末级
购买 SQLite加密扩展
( SEE
)的永久源代码许可,一次性费用为2000 $(截至2020年2月)-购买链接
使用 SQLCipher
-SQLCipher是一个SQLite扩展,它提供数据库文件的256位AES加密- https://system.data.sqlite.org/index.html/tktview?name = 9c330a3e03
I have an encrypted database using "SQLite Cipher". When I try to connect to the database using Connection string the following error message appears:
'SQL logic error Cannot use "Password" connection string property: library was not built with encryption support.'
Imports System.Data.SQLite
Public Class frm_projects
Dim dtset As New SQLiteConnection("Data Source=Setting.db;Password=m;")
Private Sub frm_projects_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
If dtset.State = ConnectionState.Closed Then
dtset.Open()
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Warning")
End Try
End Sub
End Class
Image From DB Browser sqlite Cipher
Source of the issue
I assume that the actual reason for this error is the the lack of support in "legacy CryptoAPI" since System.Data.SQLite
version ~1.0.113.1.
It was done in the following commit: https://system.data.sqlite.org/index.html/info/1dd56c9fd59a10fd
What can we do?
Manually Use the last NuGet version with CryptoAPI support - 1.0.112.2.
Notice - It must be done manually - either by editing
PackageReference
incsproj
or by editingconfig.packages
. the reason is that older versions are unlisted (!) from the NuGet feed:Buy perpetual source code license for
SQLite Encryption Extension
(SEE
) which costs one time fee of 2000$ (as of Feb 2020) - purchase linkUse
SQLCipher
- SQLCipher is an SQLite extension that provides 256 bit AES encryption of database files - GitHub source (haven't tested it myself!)
Data Sources
- https://system.data.sqlite.org/index.html/tktview?name=9c330a3e03
- https://stackoverflow.com/a/64392325/426315
这篇关于SQLite连接字符串具有加密的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!