黑莓:如何使用 PersistableRIMKeyStore?
我需要安全地存储私人用户数据,以便它可以在我的应用程序启动以及设备重置时持续存在。
我猜这将是一个最多 1000 个字符的字符串。
有人告诉我可以使用 RIM KeyStore API 来实现此目的。
好吧,我花了几个小时在谷歌上搜索有关 RIM KeyStore API 使用的任何提示。 JDE 示例不包含任何对此有用的内容。
看起来这在 BB 开发中很少见,所以几乎没有这方面的官方信息。
我读了 这个和这个。从这些我了解到,对我来说最好的选择是使用 PersistableRIMKeyStore (它在设备重置后仍然存在)。但是我无法弄清楚具体的实施应该是什么。
任何人都可以帮助提供示例代码或为我提供一些指南吗?另外,也许我的任务有更好/更简单的方法/方法,所以请让我知道。
非常感谢!
I need to securely store private user data so it can persist across my app starts as well as device resets.
This will be a String I guess about 1000 chars at maximum.
I was told I can use RIM KeyStore API for this.
Well, I spent hours googling out any gide on RIM KeyStore API usage. JDE samples do not contain anything useful on this.
Looks like this is a rare thing in BB development, so there's almost no official info on this.
I read this and this. From those I understood the best choice for me is to use PersistableRIMKeyStore (it persists across device resets). However I am not able to figure out what exactly should the implementation be.
Can anyone help with sample code or point me to some guide? Also maybe there's a better/simpler way/approach for my task, so, please, let me know about it.
Thanks a lot in advance!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的商店与“PersistentStoreDemo”相同,如果您不知道,可以通过转到“文件”->“PersistentStoreDemo”来获取该商店。导入-> Blackberry Samples,您可以对商店中的信息进行加密。除此之外,如果用户启用了内容保护,您可以使用 ContentProtectedHashtable 自动知道该信息将被加密。因此,如果没有内容保护,信息将被加密一次,启用后,它将被双重加密,并以难以猜测的应用程序名称空间的长哈希值存储(显然,因为要注册您需要它的商店)。下面是我使用的:
以及一类常量(如果需要,可以将其包含在上面)。例如,从我的 PhillyD 应用程序:
package ca.dftr.phillyd.lib.persistables;
If you use the store in the same was as the "PersistentStoreDemo" which if you don't know you can get by going to File -> Import -> Blackberry Samples, you can encrypt the info in the store. On top of this, if the user has content protection on, you can use a ContentProtectedHashtable to automatically know that that information would be encrypted. So, without content protection, the info would be encrypted once, with it on, it would be doubly encrypted as well as stored with a hard to guess long hash of the app namespace (obviously, since to register the store you need it). Below is what I use:
Along with a class of constants (which could be included in the above if you want). For example, From my PhillyD app:
package ca.dftr.phillyd.lib.persistables;
PersistableRIMKeyStore 用于持久保存 RIM 密钥存储。要在重置期间保留用户数据,您只需要使用 PersistentStore,如果您希望保护数据,您可以使用 ContentProtectedHashtable 或 ContentProtectedVector。
The PersistableRIMKeyStore is used to persist the RIM Key Store. To persist user data accross resets you only need to use the PersistentStore, if you want the deta to be protected you could use the ContentProtectedHashtable or ContentProtectedVector.