Mobile handsets such as cellphones typically have an address book to keep track of people we like to stay in touch with, a calendar to keep track of important events, and a to-do list to keep track of items we don't want to forget. This type of personal information is one of the most important functions found in a handset, just second to voice. You can use the PIM API for Java ME to enable your mobile Java applications to read and write to/from the locally stored personal information databases. You can even write synchronizers to keep your handset PIM data in-sync with remote PIM data stores. This article, part 3 of this series on using the PIM API for Java ME, covers security considerations when using the PIM API for Java ME on top of the Mobile Information Device Profile version 2. Contents
Handling personal data has privacy and security implications-no one wants their personal information to be accessed by unauthorized people. Because the PIM API for Java ME provides access to personal and possibly sensitive information, there are security concepts to understand, and considerations to keep in mind, such as the impact to the user experience, the application development, and deployment. The PIM API for Java ME does not define a security mechanism, but instead uses the underlying platform's security framework. On some platforms, such as the Mobile Information Device Profile (MIDP) version 2, the security framework is based on an authorization model that is based on the concepts of trust, permissions that protect access at the API level, and protection domains that define groupings of related permissions (and their related access and user-interaction policies) that are granted as a group to MIDlet suites that bind to such protection domain. Defined protection domains include the network While MIDP defines the valid protection domains such as the ones enumerated above, the protection domain policies themselves or how APIs are protected on mobile handsets such as cellphones or smartphones, are typically defined by the network operator. For example, while one particular network operator may allow untrusted applications to open PIM databases only if the user grants permission, another operator may decide to only provide access to trusted/signed MIDlets, while another operator may decide to provide unrestricted access. In the MIDP authorization model, a trusted application is one that is signed using X.509 PKI certificates, as described later in this article, and for which both its origin and integrity can be verified, and which is bound to one of the valid protection domains listed above. Trusted applications are given access to restricted APIs while avoiding the user prompts that degrade the user experience. Untrusted applications are the converse, and are applications that are unsigned, and which, upon installation, are automatically assigned to the unidentified or untrusted third party protection domain, which either doesn't get access to restricted APIs and/or users are prompted for permission when the application tries to get access to the restricted APIs. Untrusted applications don't need to request permissions, as by default their access is limited to non-restricted APIs, and/or are always exposed to user permission prompts. Trusted applications must request permission to access restricted APIs. In MIDP version 2, permissions are requested by way of the JAD and/or the JAR Manifest, and granted (or not) by the platform or the user, as dictated by the protection domain when a particular operation is invoked. Note that for signed MIDlets, permissions must be defined in the JAR Manifest alone, or if defined in the JAD file, identical attributes entries must also be included in the JAR Manifest or the application will fail to install. This is done to prevent permissions from being changed without proper authorization. To request permission to use a specific API, the application must include the attributes The following table, taken from the MIDP 2.0 recommended practices for using the PIM APIs within MIDP 2 JSR 118 security models addendum, summarizes the valid PIM Permissions and Protected APIs: Table 1: PIM API for Java ME - Permissions and Protected APIs
Note that all the above methods are from the In summary, getting the names of, or opening a PIM list in Attempting to access PIM resources without the proper permission will result in a The following code snippet shows how to request
As previously mentioned, for signed MIDlets, permissions must be defined in the JAR Manifest alone, or in both the JAD file and the JAR Manifest, to prevent permissions from being changed without proper authorization. Once the appropriate permissions have been requested as shown above, the application can use the PIM API, as illustrated in the following code snippet, which is attempting to open the default event list:
Note how the above code snippet performs a try/catch for Next, let's briefly describe the major steps for signing a MIDlet suite. Signing a MIDlet is a four step process. Note that the low-level details of how to generate the digital certificates and signatures are outside the scope of this article:
Once the MIDlet suite is properly signed, and has been authenticated and verified during provisioning and installation, it is considered a trusted application. By properly requesting permissions, it not only gives the MIDlet suite access to restricted APIs, but also enhances the user experience by avoiding user permission prompts.
Many thanks to Kevin Lym, Vasily Isaenko, and Alexander Glasman for all their feedback and helping improve this article. C. Enrique Ortiz is a mobile technologist, software architect and developer, and a writer and blogger. He has been author or co-author of many publications, and is an active participant in the Java mobility community and in various Java ME Expert Groups. Enrique holds a B.S. in Computer Science from the University of Puerto Rico and has more than 17 years of software engineering, product development, and management experience. | |||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||