pagetop
Javablog
by Java coders, for Java coders RSS

How MIDlet Signing is Killing J2ME

August 9th, 2007 by Sam

I recently wrote some major updates to OpenLAPI. The update allowed our OpenLAPI to be shipped with a J2ME application, wrapping the Location API (JSR-179) if it is available on the device, otherwise falling back to GPS over Bluetooth mode, or a variety of backends (e.g. CellID lookup).

I was going to blog about the technical challenges that I encountered in doing this, but the changes were rolled back and will never see the light of day. Instead I’m going to tell you all about how stupid the security model is on J2ME and how the Unified Testing Initiative is killing J2ME. I’ll also explain why it means libraries like OpenLAPI will always have to be device specific.

How MIDlet signing used to be

In the beginning of J2ME, it was decided that applications should be signed by a trusted authority or the user would be prompted to grant access to sensitive APIs. Practically, this meant that J2ME developers had to buy a signing certificate from somebody like Verisign or Thawte, costing about $500 for an unlimited number of signatures per year. Or you could upload your own self-made certificates to your handset for development purposes. David Hayes wrote an excellent tutorial on the subject.

The benefit was… nothing… actually. The user is still prompted to allow the application to access the network and instead of the user getting a confusing technical note during installation about “this application is not signed”, they get a confusing technical note saying “this application has been signed by XYZ”. So nobody signed their MIDlets.

Then along came the JSRs

MIDP2/CLDC1.1 was an upgrade to the initial J2ME offering, adding a bunch of APIs that everybody was craving (mostly for games). They did this really well… the APIs were developed with input from the developers and I am especially impressed by how nice javax.microedition.lcdui.game.* is.

Having laid down the foundations of J2ME, standards for optional libraries were created to allow support for device hardware such as sms and cbs (JSR-120), bluetooth (JSR-82), file system Access (JSR-75), cameraphone and speakers (JSR-135), webservices (JSR-172) and location awareness (JSR-179).

This was a great idea! However most of these new APIs require a trusted signature on the application. So, forking out for a Verisign or Thawte signature made it impossible to write hobby projects. This was the death of open source J2ME beyond gaming.

Then along came the clowns (network operators)

When people started having to sign their applications, they realised that Versign and Thawte and Geotrust and their friends were not supported on the devices in circulation! The reason was simple… J2ME never specified a list of default certificates that should be supported.

Handset manufacturers would ship with seemingly random collections of certificates meaning that developers had to get their key signed by every authority they could find. This pushed the entrance price up to a few thousand dollars a year.

But it got worse… the network operators were “customising” the certificate stores on handset requiring everything to be signed by them as well as the handset manufacturer! And the handset manufacturers stopped allowing developers to upload their own certificates in order to run their own code on their own device.

The Unified Testing Initiative

Seeing a problem, the J2ME working groups decided that they needed a single place where applications could be verified as non-malicious and signed with a certificate that would be guaranteed to exist at runtime. Wonderful news! Until somebody seen that they could make a fortune by bleeding the developers dry.

The central repository is the Java Verified Program. It lets you upload your jar/jad file and then it does some automated tests (which are b0rk3n… more on this later). It then lets you decide which devices you wish to test on before letting you select who to send your application to.

Yes, it needs to be manually checked! And only by commercial entities that struck an insanely lucrative deal. To give some examples… it costs about $300 per test, per device! That means if you want to write a J2ME application that uses a “restricted API” on all supporting devices, you could potentially end up spending $30,000 per bug fix! It’s not unrealistic to spend half a million dollars per application. It gets worse… some operators may also require you to dual sign your applications with them, so this may well only be half the cost of the signing process.

I noted that the automated process is broken. This is the reason why a single OpenLAPI jar cannot be part of a UTI-signed application. The whole point of OpenLAPI is to detect JSR-179 and use it if it is available, otherwise using alternatives. It does this using a combination of reflection and wrappers which know when a cast is valid. The UTI process detects that javax.microedition.location.* is used, and plain refuses to allow the tests on anything other than high-end Nokia phones. Defeating the entire purpose! This is why the next release of OpenLAPI will not be as amazing as it could have been.

Conclusion

I really do not see any reason why the signing process has to be bundled with a testing process. And given that J2ME is entirely sandboxed anyway, I don’t see why a human needs to check the application for malicious behaviour.

The decision to restrict JSRs to signed MIDlets was possibly a wise one (identity management through SSL certificates is A Good Thing™). However, it killed open source and hobby J2ME development.

The decision to standardise the certificates on a device was a logical and common-sense answer to a problem that had plagued everybody.

The decision to unify the certification and testing, relying on third party developers in a lucrative position to charge whatever they wanted, whenever they wanted or your application doesn’t hit the shelf is possibly the stupidist thing I have ever heard!

What should have happened is that the J2ME standards committee should have given out a list of standard certificates that must be on a device. They should also have suggested that handset manufacturers allow the uploading of self-signed certificates so that open source and hobby programmers could write programs for their own handsets.

What has now happened is that nobody can afford the prices of testing and signing anymore, so developers stick to creating games. Innovation has been completely killed and if anybody really wants access to the hardware, they either write it entirely in Symbian or use a Symbian component to speak to Java. My understanding is that the Symbian signing process still allows Verisign and self-signed certificates.

So that is why MIDlet Signing is killing J2ME. Long live the iPhone! Let’s hope Apple give all these operators and manufactures a good kick up the butt, just so we can feel some form of vengeance for their incompetences.


This entry was posted by by Sam on Thursday, August 9th, 2007 at 12:42 pm, and is filed under J2ME, Java, MIDlets, OSS, OpenLAPI, Security, Signing. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.



21 comments on “How MIDlet Signing is Killing J2ME”

Regarding “Long live the iPhone!”

By all means, but you can’t access anything in the phone via web applications like you can via MIDP, Symbian etc.

I’ve tried to strike a middle ground: I develop mobile applications (not games) but I don’t certify. Instead I try to avoid the most warning-intensive functions, like file access etc. E.g. it’s possible to make an application that accesses the Location API with only one warning during start and then none. Same with camera etc.

I wrote a similar post a few months ago:

http://www.spenceruresk.com/2007/05/26/the-hidden-problem-with-j2me/

I agree completely - signing is basically killing hobbyist and open source development the way carriers currently use it. This is unfortunate because there are so many cool things you can do with J2ME in theory.

I don’t see why you are cheering for the iPhone though - it locks out all development basically, and they are being exclusively offered through AT & T, who is one of the operators using signing to keep small players out of mobile app development.

Thanks for your comment Anders!

I’m aware that the iPhone suffers from hardware problems… I was meaning this as “I hope Apple cut into the pockets of the people who did this to us” rather than “the iPhone is a wonderful development environment”. I certainly don’t think the iPhone is a good mobile development environment :-)

Good point about the camera phone… but I’m afraid the location API is not as forgiving. If you check the Motorola specs you’ll see that MMAPI (camera phone) requires user permission, but Location API requires a signed MIDlet and permission.

It’s also very annoying that user permission is not persistent across sessions… but that’s another rant for another day.

I’ve tested on Nokia and Sony Ericsson phones and Location API only gives off one warning the way I use it, and after that it’s smooth sailing, even though I read out coordinates constantly, so the Motorola behavior is not universal.

Thanks Anders… that’s interesting to note and also more proof that the security policy destroys any hope of device homogeneity that J2ME gave us.

I agree that when the midlet is signed (no matter by who) it should stop the prompts. Users should assume the risk if any.

The sentiments are absolutely spot on, though you have rewritten history a fair amount to improve the narrative flow ;) Saves me the trouble of writing a similar post, I gave up on code signing when I first tried it 3 years ago as it was immediately clear that it was a nice idea that had been destroyed by the greed of operators and some manufacturers (Moto are bad, others are better).

It’s worth noting that not every API you mention requires code signing to work - WMA works without on pretty much every device. The user does get asked for permission before doing things like sending an SMS, but that is a sensible security requirement IMHO.

suryavardhan agrawal wrote:

Hi,

I have a J2ME application, also I have got a certificate from Thawte, but when I run the application on certiain Nokia devices, it prompts me for certian permission. Can you explain me what can be the exact reason behind this.

Suryavardhan Agrawal, I think you just proved my point.

Situation is quite similar in Symbian with native applications: http://www.ivankuznetsov.com/2007/08/symbian-os-platform-security-good-or-evil.html Certification was a nice idea, but as they say the road to hell is paved with good intentions.

Justin Pretorius wrote:

Surely its obvious that the future of software / application development is in mobile devices.. and then doesnt it make sense to feed the need by creating easy paths from concept to market. The only way that this kind of developement can thrive is for security levels to be REDUCED (exactly as they are on the PC) and allow the user a choice whether to trust a piece of software or not (potentially signing could be a criteria .. but in a more productive way). We are currently developing software that requires extensive use of jsr-75 (file api) .. you can imagine the absolute stupidity of 2 questions for every read / write operation .. my word .. LETS MOVE FORWARD.

What I really ‘love’ about signing J2ME apps is that the certificate is only valid from the date you bought it (not valid for the past). So _even_ if we manage to get past all the problems mentioned _and_ we’re willing to accept that the user is still going to be bugged by a certain amount of security questions, if the user didn’t set the date on their handset (not that unusual, people generally use their handset for the time only) and it defaulted to something like 1st Jan 2002, the certificate will not be valid and the user gets a nice friendly “install failed” message which makes us look great! (I asked verisign once to sell me a certificate that was back dated by 10 years but they couldn’t do it.)

Derek Konigsberg wrote:

I never realized how bad it was, given that I only develop for the BlackBerry. On the BlackBerry, you basically have signed and unsigned APIs. (and can do quite a bit with the unsigned APIs) To use the signed APIs, you just have to fork out $100/year to RIM, that’s it. I thought it was annoying, but now I realize that I should be grateful for it.

Yes, I do write an open-source non-game application for the BlackBerry. I’ve been doing everything and anything to avoid a signing requirement, simply because of the implications it would have for an open-source project. I know I’ll have to bite the bullet eventually, though.

Ali Kianzadeh wrote:

“Java Verified Program” Is realy bad, you can’t get certifcation before test and you can not do real test on many devices without certificate. Some phone manuafactures doesn’t let you to import your certifcate to thier device.

I think is time to open source community find a way to issue developer certificate free or with a low price.bore J2ME died.

It really is that bad. If you want to read some first hand J2ME experiences and tips, see http://www.j2mesecrets.com where I tell the whole sorry story.

John Dickerson wrote:

Axiom:

Those who have the authority to make J2ME a very exciting and cutting edge platform have behaved like a bunch of useless and intellectually deficient muppets. The result is much J2ME innovation and open source contribution has been totally killed through a combination of human stupidity and greed of opportunistic companies charging to verify and sign applications.

Does anyone from the J2ME standards committee or companies that charge extortionate fees for testing and signing J2ME applications have anything to say about this Axiom?

We want to know!

J2ME, in my opinion, is going to die over the next few years. It might have an enormous market share but the cost structure is too high due to : porting costs, testing costs, signing costs, and the need to hire someone full-time to pander to the carriers. BREW is messed up because it still has high porting and testing costs (not as bad as J2ME but still bad). Plus the way Qualcomm has set up the business model makes it very difficult.

Windows Mobile, Symbian, Android, and potentially the new iPhone SDK are much easier to develop for because:

  • they are easier to port to multiple devices of the same OS
  • provide far more hooks into the native OS and other applications, allowing for more compelling applications.
  • having easier signing requirements
  • Allow for clean upgrades of a binary for version updates/bug fixes.

FlashLite, unfortunately, seems to be far behind in what it can offer.

Man I don’t know how the mobile development world got so ugly. I hate to say it but I wish it was like the PC world where you just have to create Windows and OS X, and perhaps a Linux version — and you’re done.

Why should you have to have a certificate on a phone, but not on a PC?

Hello Sam,

Several comments:

  • first, glad that you like MIDP2.0 Game API, as I was higly involved on it in my previous job (In-Fusio/CTO, where In-Fusio “donated” his Game API to the Java community

  • concerning security: it’s even worst now with Symbian 9.0, where you CANNOT deploy any app without being signed! In this regard, MIDP security model is like a dream! This require end user to sign himself, on the web, with his IMEI…Who will do this?

  • let’s hope that androids will drive things in the right direction. Not because this a new platform, so more fragmentation, but because JavaAPP are first class cityzen. So let’s hope that security model will be much more open and useful.

Last thing, I’ve been here through the OpenLAPI library, I’ll take a look at it, to eventually replace the code produced with my app, 8Motions ( http://www.8motions.com ).

One idea, use CellID as a location provider: http://www.opencellid.org

@Tomsoft thanks for your comment!

CellID is certainly something I’ve looked at quite a bit. Problem is that you can’t get the CellID on anything other than old Motorolas and Sony Ericsson. Motorola allow this iff your MIDlet is signed by Motorola (UTI isn’t even enough!).

I’ve also even investigated getting the CellID from the CBS headers, but J2ME strips them out! I was actually only able to find 2 CBS channels in the UK anyway, and both were on Vodafone networks… so that killed that idea.

Even then, you still need a reverse lookup database on the device or over the network. In the UK there has been some legal action prompting Ofcom (the industry regulator) to open up its database. This was recently appealed, but the appeal was crushed. Most of the network providers have since retracted donating their databases to Ofcom. There are community projects to map the CellID terrain.

I believe that you, like many people in the community, are exaggerating. 1. Does a question about a permission here or there really stops an end user from using an application? 2. You can make it less painful if you let the user know that they will be asked for a permission and that they are supposed to say ‘Yes’. 3. You can make as many alternatives as possible. I.e. let them use FileConnection JSR-75 to access a file, BUT still make it possible to access the file from outside the application.

/Yar @ YarMobile

Leave a comment

Markdown is supported.

To include code snippets in your comment, use

<pre><code># lang java
... code here ...
</code></pre>

or use 4 spaces at the start of the line instead of using code and pre tags.

Comment feed: RSS