[收藏]MIDlet如何签名的tutorial

简介:

MIDlet jar signing (a tutorial)

http://www.spindriftpages.net/pebble/dave/2005/06/20/1119275880301.html

I needed to sign a MIDlet and deploy it on a Nokia Series 60 phone (i.e. 6630, 6680 etc) so the user doesn't constantly get security alerts. I figured (hoped?) this might be a fairly simple task since any useful application is likely to need access to restricted functionality. It turns out I was very, very wrong. There is virtually no information on how to sign and deploy an application on the web. Anyway here are the steps I took to get to et my MIDlet signed and installed!

Get required software

1. Get and install the Java SDK (JDK) from Sun (you should already have this)

2. Get and install the Java Wireless Toolkit (WTK) also from Sun

3. Optionally get and install Ant and Antenna to allow you to automate your build

Create and import a certificate

1. You need to use keytool (from the JDK)

2. I used the following command keytool -genkey -alias {myalias} -keyalg RSA -validity 365

3. This will prompt you for a keystore password, enter your keystore password (if you have an existing keystore) or the one you want to use if you don't have one yet

4. Fill in all the prompts about location/company name etc

5. Run keytool -list to see your new certificate

6. Next you must export the certificate so you can import it to your phone

7. Run keytool -export -alias {myalias} -file mycertificate.crt

8. Import the certificate into your phone, in Windows XP SP2 I could do this by right clicking the file and selecting "Send to Bluetooth Device"

Build and package the application

1. Use javac to build your MIDlet paying special attention to your classpath and bootclasspath options (otherwise preverification will fail). I also set target to 1.1 and source to 1.3

2. Generate your JAD file the critical attributes in the JAD are MIDlet-Jar-URL, MIDlet-Jar-Size, MIDlet-Permissions we also included MIDlet-Icon, MicroEdition-Configuration, MicroEdition-Profile, MIDlet-Name, MIDlet-Push-1, MIDlet-Icon, MIDlet-Descriptionn and MIDlet-Version

3. Generate the MANIFEST.MF file based on your JAD, you must remove MIDlet-Jar-Size and MIDlet-Jar-URL

4. Both these tasks can be completed using the wtkJad Antenna task

5. Package and preverify the app using the wtkPackage Antenna Task you must set the classpath and bootclasspath properties correctly otherwise Preverification will fail

Sign the application

1. Sign the Application using jarsigner

2. Run jarsigner -keystore {mykeystore} -storepass (mypassword} {myjar} {myalias}

3. Now you have a signed jar you need to update the MIDlet-Jar-Size in your JAD

4. Now add the certificate to the JAD using JadTool.jar from the WTK

5. Run java -jar JadTool.jar -addcert -alias {myalias} -storepass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}

6. Now add the signature to the JAD again using JadTool.jar

7. Run java -jar JadTool.jar -addjarsig -alias {myalias} -jarfile {myjar} -storepass {mypassword} -keypass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}

8. You can now deploy this to a webserver with the MIME types set correctly and download it to your phone and it will be a trusted 3rd party application

目录
相关文章
|
11天前
|
数据采集 人工智能 安全
|
6天前
|
机器学习/深度学习 人工智能 前端开发
构建AI智能体:七十、小树成林,聚沙成塔:随机森林与大模型的协同进化
随机森林是一种基于决策树的集成学习算法,通过构建多棵决策树并结合它们的预测结果来提高准确性和稳定性。其核心思想包括两个随机性:Bootstrap采样(每棵树使用不同的训练子集)和特征随机选择(每棵树分裂时只考虑部分特征)。这种方法能有效处理大规模高维数据,避免过拟合,并评估特征重要性。随机森林的超参数如树的数量、最大深度等可通过网格搜索优化。该算法兼具强大预测能力和工程化优势,是机器学习中的常用基础模型。
326 164
|
5天前
|
机器学习/深度学习 自然语言处理 机器人
阿里云百炼大模型赋能|打造企业级电话智能体与智能呼叫中心完整方案
畅信达基于阿里云百炼大模型推出MVB2000V5智能呼叫中心方案,融合LLM与MRCP+WebSocket技术,实现语音识别率超95%、低延迟交互。通过电话智能体与座席助手协同,自动化处理80%咨询,降本增效显著,适配金融、电商、医疗等多行业场景。
328 155
|
6天前
|
编解码 人工智能 自然语言处理
⚽阿里云百炼通义万相 2.6 视频生成玩法手册
通义万相Wan 2.6是全球首个支持角色扮演的AI视频生成模型,可基于参考视频形象与音色生成多角色合拍、多镜头叙事的15秒长视频,实现声画同步、智能分镜,适用于影视创作、营销展示等场景。
391 4
|
14天前
|
SQL 自然语言处理 调度
Agent Skills 的一次工程实践
**本文采用 Agent Skills 实现整体智能体**,开发框架采用 AgentScope,模型使用 **qwen3-max**。Agent Skills 是 Anthropic 新推出的一种有别于mcp server的一种开发方式,用于为 AI **引入可共享的专业技能**。经验封装到**可发现、可复用的能力单元**中,每个技能以文件夹形式存在,包含特定任务的指导性说明(SKILL.md 文件)、脚本代码和资源等 。大模型可以根据需要动态加载这些技能,从而扩展自身的功能。目前不少国内外的一些框架也开始支持此种的开发方式,详细介绍如下。
925 7