Netbeans 移动性中的特权操作
我正在编写一个 Java ME 应用程序,它将使用特权操作(例如消息传递)。默认情况下,系统会提示用户确认每个操作,但我想将其作为后台服务运行。
文档说要在 jad 文件中请求许可,我已经这样做了,并假设它可以在设备上运行。不过,我想首先在 Netbeans 移动模拟器上测试一下。
我尝试将应用程序签名为“受信任”,但我的模拟执行仍然提示用户授予许可。
I'm writing a Java ME app that will use privileged operations such as messaging. By default the user is prompted to confirm each of these operations, but I would like to run it as a background service.
Documentation says to request permission in the jad file, I have done so and presume it will work on a device. However I would like to test this on the Netbeans mobility emulator first.
I tried signing the app as "trusted" but my emulated execution still prompts the user for permission.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MIDP 安全模型需要分两部分进行解释:
电话(或模拟器)包含安全策略。
安全策略由多个域组成。
每个域定义功能组和根证书。
功能组决定哪些保护选项(始终自动同意、始终用户同意、用户一次同意...)在受保护的 API(即消息传递)的域中可用。
适用于您的 MIDlet 的域取决于哪个根证书信任您为 MIDlet 签名所使用的证书。
您的问题是,您认为您的 MIDlet 所属域中所需的 API 的保护选项与模拟器安全策略中实际定义的内容不匹配。
编辑:
基于 WTK 的模拟器的操作方法:
${netbeans_installation_folder}\mobility8\WTK2.5.2\j2mewtk_template\appdb\
中有 3 个_policy.txt*
文件文件夹。它们各自包含“别名”定义列表和“域”定义列表。
使每个域具有与“最大”域相同的内容。
此后,您的模拟器将不再请求任何用户权限。
如果您已经使用过 Netbeans 中包含的模拟器,则可能需要对
${netbeans_installation_folder}\mobility8\WTK2.5.2\appdb\
文件夹进行相同的更改。The MIDP security model needs to be explained in 2 parts:
The phone (or the emulator) contains a security policy.
The security policy is made of several domains.
each domain defines function groups and root certificates.
a function group decides which protection options (auto agree always, user agree always, user agree once...) are available in the domain for which protected API (i.e. messaging).
The domain that applies to your MIDlet depends on which of the root certificates trusts the certificate you signed your MIDlet with.
Your problem is that there is a mismatch between what you think the protection options should be for the API you want in the domain you think your MIDlet belongs too and what is actually defined in the emulator security policy.
EDIT:
how-to for WTK-based emulators:
There are 3
_policy.txt*
files in the${netbeans_installation_folder}\mobility8\WTK2.5.2\j2mewtk_template\appdb\
folder.They each contain a list of "alias" definitions and a list of "domain" definitions.
Make every domain have the same content as the "maximum" domain.
After this, Your emulator will never again ask for any user permission.
If you have already used the emulator contained in Netbeans, you probably want to make the same changes to the
${netbeans_installation_folder}\mobility8\WTK2.5.2\appdb\
folder.