一段MD5编码程序,在WTK2.2中编译通过,但模拟器中运行报错.请大家帮忙看看.
错误信息如下:
java.lang.SecurityException: Application not authorized to access the restricted API
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+40)
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+7)
at com.sun.midp.midletsuite.MIDletSuiteImpl.checkIfPermissionAllowed(+8)
at com.sun.midp.midlet.MIDletState.<init>(+78)
at javax.microedition.midlet.MIDletProxy.<init>(+5)
at javax.microedition.midlet.MIDlet.<init>(+13)
at Key.<init>(+4)
at Key.getHashString(+7)
at Key.MD5(+26)
at Key.commandAction(+144)
at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+250)
源代码是从网上找的,主要都是数组和位运算,应该没有问题. 不知道j2me环境有什么特殊限制?
代码太长, 我就不放上来了, 大家可以自己搜索. 或者哪位能提供一个可以在j2me环境下运行的md5算法实现代码?