netbeans 移动性中的特权操作 [英] Privileged operations in netbeans mobility

查看:31
本文介绍了netbeans 移动性中的特权操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 Java ME 应用程序,它将使用诸如消息传递之类的特权操作.默认情况下,系统会提示用户确认每项操作,但我想将其作为后台服务运行.

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.

文档说要在 jad 文件中请求权限,我已经这样做了,并假设它可以在设备上运行.不过,我想先在 Netbeans 移动模拟器上对此进行测试.

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.

推荐答案

MIDP安全模型需要分两部分解释:

The MIDP security model needs to be explained in 2 parts:

手机(或模拟器)包含安全策略.
安全策略由多个域组成.
每个域都定义了功能组和根证书.
功能组决定哪些保护选项(自动始终同意、用户始终同意、用户同意一次...)在受保护 API(即消息传递)的域中可用.

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).

适用于您的 MIDlet 的域取决于哪个根证书信任您为 MIDlet 签名的证书.

The domain that applies to your MIDlet depends on which of the root certificates trusts the certificate you signed your MIDlet with.

您的问题是,您认为 MIDlet 也属于的域中所需 API 的保护选项与模拟器安全策略中实际定义的内容之间存在不匹配.

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.

基于 WTK 的模拟器的操作方法:

how-to for WTK-based emulators:

${netbeans_installation_folder}mobility8WTK2.5.2j2mewtk_templateappdb 文件夹中有 3 个 _policy.txt* 文件.

There are 3 _policy.txt* files in the ${netbeans_installation_folder}mobility8WTK2.5.2j2mewtk_templateappdb 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.

此后,您的模拟器将不再要求任何用户许可.

如果您已经使用了 Netbeans 中包含的模拟器,您可能希望对 ${netbeans_installation_folder}mobility8WTK2.5.2appdb 文件夹进行相同的更改.

If you have already used the emulator contained in Netbeans, you probably want to make the same changes to the ${netbeans_installation_folder}mobility8WTK2.5.2appdb folder.

这篇关于netbeans 移动性中的特权操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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