有人在 Monotouch 的 sqlite 数据库上成功使用过密码吗? [英] Anyone successfully used password on sqlite database in Monotouch?

查看:26
本文介绍了有人在 Monotouch 的 sqlite 数据库上成功使用过密码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 sqlite 数据库的 Monotouch 应用程序.我想加密数据库,所以我这样做:

I have a Monotouch app which uses a sqlite database. I want to encrypt the database so I am doing this:

_mainConnection = new SqliteConnection("Uri="+finalDB);
_mainConnection.Open();
_mainConnection.ChangePassword("mypassword");

但是,它不起作用(在模拟器和 iPhone 上).它得到这个错误:

However, its not working (on simulator and iphone). It gets this error:

at(包装管理到本机)Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_rekey(intptr,byte[],int) <0x0005c> 在(包装管理到本机)Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_rekey(intptr,byte[],int) <0x0005c> 在Mono.Data.Sqlite.SQLite3.ChangePassword(byte[]) <0x00053> 在Mono.Data.Sqlite.SqliteConnection.ChangePassword(byte[]) <0x0004b> 在Mono.Data.Sqlite.SqliteConnection.ChangePassword(字符串)<0x0005b>

at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_rekey (intptr,byte[],int) <0x0005c> at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_rekey (intptr,byte[],int) <0x0005c> at Mono.Data.Sqlite.SQLite3.ChangePassword (byte[]) <0x00053> at Mono.Data.Sqlite.SqliteConnection.ChangePassword (byte[]) <0x0004b> at Mono.Data.Sqlite.SqliteConnection.ChangePassword (string) <0x0005b>

有人在 Monotouch 的 sqlite 数据库上成功使用过密码保护吗?

Has anyone successfully used password protection on an sqlite database in Monotouch?

推荐答案

根据我的研究,有几个使用 MonoTouch 的数据库加密选项.我即将发布一篇关于该主题的博客文章,但目前这些是您最常用的两个选项:

As per my research there are a few options for database encryption using MonoTouch. I have a forthcoming blog post on the subject, but for now these are your top two options:

我已经大幅自动化了 SQLCipher 构建过程.只需要一个简单的 make 命令,您就拥有了一个可以链接到您的项目的库.它利用了很棒的 SQLite-NET 库.之后,所需要做的就是在 SQLite.cs 文件中提供密钥.

I've automated the SQLCipher build process substantially. All it takes is a simple make command and you've got a library that you can link into your project. It makes use of the awesome SQLite-NET library. After that, all that's required is to provide the key in the SQLite.cs file.

这是 C# 中 SQLite 库的托管端口.性能仅慢约 2 倍,考虑到它不是本机代码,这非常棒!

This is a managed port of the SQLite library in C#. Performance is only about ~2x slower, which is pretty awesome considering it's not native code!

这篇关于有人在 Monotouch 的 sqlite 数据库上成功使用过密码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆