找回密码
 加入
搜索
查看: 3002|回复: 6

[网络通信] SQLite3 加密 Win10 x64 环境测试成功

  [复制链接]
发表于 2019-11-25 15:40:24 | 显示全部楼层 |阅读模式
本帖最后由 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



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2019-11-26 22:21:04 | 显示全部楼层
学习了,正在使用SQLite3
发表于 2019-12-10 15:58:19 | 显示全部楼层
正愁怎么给SQLite加密呢
发表于 2019-12-11 08:49:16 | 显示全部楼层
暂时看不懂用在什么地方,做个标记,需要时再用。
发表于 2020-1-13 16:43:33 | 显示全部楼层
可以的,这玩意不错。奈何SQLITE3对数据处理的函数太少,方法难用。相比其他sql语言,用的很累。
发表于 2020-2-26 14:59:18 | 显示全部楼层
经测试,确实可用,感谢分享!

但SQLite_key.au3这个UDF最好作修改下:
1、头部添加
#include-once
#include <sqlite.au3>
2、以下两个变量名改下,新版的sqlite.au3已经改名了
$g_hDB_SQLite   改为:  $__g_hDB_SQLite
$g_hDll_SQLite   改为: $__g_hDll_SQLite
发表于 2020-3-1 00:06:24 | 显示全部楼层
跟着学习一下。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-24 12:33 , Processed in 0.078972 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表