加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

加密,解密Sqlite数据库

发布时间:2020-12-12 20:09:51 所属栏目:百科 来源:网络整理
导读:加密,解密Sqlite数据库 加密,解密Sqlite数据库 加密一个未加密的数据库或者更改一个加密数据库的密码,打开数据库,启动SQLiteConnection的ChangePassword()函数 // Opens an unencrypted database SQLiteConnection cnn = newSQLiteConnection("Data Source=

加密,解密Sqlite数据库

加密,解密Sqlite数据库

加密一个未加密的数据库或者更改一个加密数据库的密码,打开数据库,启动SQLiteConnection的ChangePassword()函数

// Opens an unencrypted database

SQLiteConnection cnn = newSQLiteConnection("Data Source=c:test.db3");

cnn.Open();

// Encrypts the database. The connection remains valid and usable afterwards.

cnn.ChangePassword("mypassword");

解密一个已加密的数据库调用l ChangePassword()将参数设为 NULL or "" :

// Opens an encrypted database

SQLiteConnection cnn = newSQLiteConnection("Data Source=c:test.db3;Password=mypassword");

cnn.Open();

// Removes the encryption on an encrypted database.

cnn.ChangePassword("");

要打开一个已加密的数据库或者新建一个加密数据库,在打开或者新建前调用SetPassword()函数

// Opens an encrypted database by calling SetPassword()

SQLiteConnection cnn = newSQLiteConnection("Data Source=c:test.db3");

cnn.SetPassword(newbyte[] { 0xFF,0xEE,0xDD,0x10,0x20,0x30 });
cnn.Open();

// The connection is now usable

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读