Windows Phone 7 - 带加密的 SQLite
我使用 System.Data.SQLite Windows Mobile 中的 SQLite。它具有内置的加密支持。我发现了许多 Windows Phone 7 的 SQLite 实现。但是,它们都没有内置的加密支持。有人知道支持加密的 Windows Phone 7 SQLite 实现吗?
I was using System.Data.SQLite for SQLite in Windows Mobile. It has built-in encryption support. I have found many SQLite implementation for Windows Phone 7. But, none of them have built-in support for encryption. Anybody knows any SQLite implementation for Windows Phone 7 that supports Encryption?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终使用了 Mango 版本 (Windows Phone 7.1) 中引入的 SQL CE,它具有内置的加密(密码)支持。请参阅
I ended up using SQL CE introduced in Mango release (Windows Phone 7.1) which has in-built encryption (password) support. Refer to http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2011/05/24/windows-phone-mango-what-s-new-local-database-part-1-of-8.aspx which has very good explanation.
Windows Phone 7 中似乎没有任何 API 可以让您根据类似于 DPAPI 的用户凭据加密/解密数据,因此您必须自己完成。 文档建议以下内容Windows Phone 7 上提供了以下算法:
这些算法应该可以满足您的所有需求要创建一个像样的加密模式,加密数据库模式中的敏感列而不是整个数据库就足够了。
那么唯一的问题是看看使用什么键。如果可以要求用户输入密码(这很大程度上取决于您正在构建的应用程序类型),那么您可以使用 Rfc2898DerivedBytes 从用户输入中派生密码。否则,您可以从某些设备数据创建密钥。 (请参阅:如何获取对称密钥在 Windows Phone 7 中?)派生密钥后,您可以使用 AES 进行加密。
我知道这正是您想要的,但至少应该为您指明正确的方向。
There doesn't seem to be any API in Windows Phone 7 that will let you encrypt / decrypt data based on user credentials similar to DPAPI so you have to do it yourself. The documentation suggests that the following algorithms are available on Windows Phone 7:
These algorithms should give all you need to create a decent encryption schema and it should be good enough that you encrypt the sensitive columns in your database schema and not the whole database.
The only problem then would be to see what key to use. If it's possible to ask the user for a password (this very much depends on what type of application you are building), then you can use Rfc2898DerivedBytes to derive a password from the user input. Otherwise, you can create a key out from some device data. (see: How do I get a symmetric key in Windows Phone 7?) After deriving a key, you can use AES to do your encryption.
I know that this is exactly what you wanted, but at least should point you in the right direction.