Privileged operations in netbeans mobility

允我心安 提交于 2019-12-29 06:30:53

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/1710423/privileged-operations-in-netbeans-mobility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!