本帖最后由 w60711 于 2019-11-25 15:40 编辑
不知道版区放得对不对,
如果错放还请版大协助移动
感谢了~
找了SQLite3的加密方法很久
终于在今天成功了~
代码以风行者大的代码做修改
放上来备忘以及让需要的人参考看看^^"
验证 成功加密:
ˋˋ直接开启会显示错误
输入连线祕法后就可以开启了
成功读取到资料
#CS
源码修改自: 风行者 大大 https://autoit8.com/forum.php?mod=viewthread&tid=31849&highlight=SQLITE%2B%BC%D3%C3%DC&_dsign=d7eb58c1
Release_AES来自:nmgwddj 大大 https://autoit8.com/forum.php?mod=redirect&goto=findpost&ptid=55857&pid=684954&fromuid=7662477
运行环境:
Windows 10 教育版 x64 1903
#CE
#include <sqlite.au3>
#include <sqlite.dll.au3>
#include "Inc\SQLite_key.au3"
#include <EditConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
Global $SQLite_Dll = @ScriptDir & "\Lib\Release_AES128\sqlite3.dll"
Global $SQLite_Dll64 = @ScriptDir & "\Lib\Release_AES128\sqlite3_x64.dll"
Global $dbPath = @ScriptDir & "\test.db"
Global $iMemo
_Initdata()
Func _Initdata()
$hGUI = GUICreate("SQLite3 加密例子", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, BitOR($ES_READONLY, $ES_AUTOVSCROLL))
GUISetState()
;;Load sqlite dll
_SQLite_Startup($SQLite_Dll, True, 1)
If @error Then
_SQLite_Startup($SQLite_Dll64, True, 1)
If @error Then Exit (MsgBox(16, "SQLite Error", "Can't load SQLite3.dll!"))
_SQLite_OpenDll($SQLite_Dll64)
Else
_SQLite_OpenDll($SQLite_Dll)
EndIf
GUICtrlSetData($iMemo, "_SQLite_LibVersion = " & _SQLite_LibVersion() & @CRLF & @CRLF, 1)
;;Open DB
$sDB = _SQLite_Open($dbPath)
_SQLite_key($sDB,'12345abc')
If @error Then Exit (MsgBox(16, "SQLite Error", "Can't load Database!"))
If Not FileExists($dbPath) Or FileGetSize($dbPath) = 0 Then
; 无结果查询中不带$sCallback
_SQLite_Exec(-1,"Create table tblTest (a,b int,c single not null);" & _
"Insert into tblTest values ('1',2,3);" & _
"Insert into tblTest values (Null,5,6);")
EndIf
_SQLite_Exec(-1,"Select oid,* From tblTest", "_cb") ; _cb将被每行调用
; 循环至用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
_SQLite_Close()
_SQLite_Shutdown()
EndFunc ;==>_Initdata
Func _cb($aRow)
For $s In $aRow
memowrite($s & @TAB)
Next
memowrite(@LF)
; 返回$SQLITE_ABORT ; 将退出并导致_SQLite_Exec()出错的操作
EndFunc
Func memowrite($s_text)
GUICtrlSetData($iMemo, $s_text & @CR, 1)
EndFunc ;==>memowrite
|