如何签署 Java Midlet?
一个简单的问题却有一个相当复杂的答案:
如何对 Java Midlet 进行签名,以便可以将其加载到安全提示较少的手机上?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
一个简单的问题却有一个相当复杂的答案:
如何对 Java Midlet 进行签名,以便可以将其加载到安全提示较少的手机上?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
获取所需的软件
导入现有证书(如果有的话)
keytool -import -alias {myalias} -file {mycertificate}
(由于我没有适当的证书,因此无法测试此命令)keytool -list
查看您的新证书keytool -export -alias {myalias} -file mycertificate.crt
创建并导入新的(测试)证书
keytool -genkey -alias {myalias} -keyalg RSA -validity 365
keytool -list
查看新证书keytool -export -alias {myalias} -file mycertificate.crt
构建并打包应用程序
javac
来构建您的 MIDlet,特别注意您的类路径和 bootclasspath 选项(否则预验证将失败)。我还将目标设置为 1.1,源设置为 1.3MIDlet-Jar-URL、MIDlet-Jar-Size、MIDlet-Permissions 我们还包括 MIDlet-Icon、MicroEdition-Configuration、MicroEdition-Profile、MIDlet-Name、MIDlet-Push-1、MIDlet-Icon、MIDlet-Description 和 MIDlet-版本
MIDlet-Jar-URL
签署应用程序
jarsigner
jarsigner -keystore {mykeystore} -storepass (mypassword} {myjar} {myalias 。
MIDlet-Jar-Size
JadTool.jar
来自 WTKjava -jar JadTool.jar -addcert -alias {myalias} -storepass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}
JadTool.jar
< strong>部署
出现在您的短信收件箱中
在手机上安装证书
右键单击该文件并选择“发送到蓝牙设备”,
您也应该能够通过电缆或红外线 (IR) 发送文件。注意:我
无论如何,还没有找到在 Series 40 手机上导入证书的方法
“应用程序安装”。在我的手机(诺基亚 6680)上,它位于
工具->设置->证书管理->信任设置,我开启了
一切,但我认为“应用程序安装”就是您所需要的
常见问题
MIDlet-Permissions
中的换行符可能会导致问题,但在诺基亚 6680/6630/6230i 上对我来说似乎没问题(可能与固件有关?)MIDlet-Permissions
属性是造成很多问题的原因(特别是因为文档经常错误/丢失或因手机而异),请尝试先将其忽略,然后在一次一个。有些手机会抱怨它们不支持的权限,有些手机会忽略它们信任域
Network Access: Not Allowed, Ask every time, Ask first time
Messaging: Not Allowed, Ask every time App
Auto-Start: Not Allowed, Ask every time, Ask first time
Connectivity: Not Allowed, Ask every time, Ask first time, Always allowed
Multimedia: Not Allowed, Ask every time, Ask first time
Read User Data: Not Allowed, Ask every time, Ask first time, Always allowed
Edit User Data: Not Allowed, Ask every time, Ask first time, Always allowed
未解决的问题
示例 JAD
示例清单
示例 Ant 构建文件
我已经把我们的 EC1M ant 构建文件 在我们的网站上发布(希望)使这一切对您来说更容易一些。
其他资源
这个诺基亚论坛上的常见问题解答值得一读。
Get required software
Import an existing certificate (if you have one)
keytool -import -alias {myalias} -file {mycertificate}
(I haven't been able to test this since I don't have a proper certificate)keytool -list
to see your new certificatekeytool -export -alias {myalias} -file mycertificate.crt
Create and import a new (test) certificate
keytool -genkey -alias {myalias} -keyalg RSA -validity 365
keytool -list
to see your new certificatekeytool -export -alias {myalias} -file mycertificate.crt
Build and package the application
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.3MIDlet-Jar-URL, MIDlet-Jar-Size, MIDlet-Permissions we also included MIDlet-Icon, MicroEdition-Configuration, MicroEdition-Profile, MIDlet-Name, MIDlet-Push-1, MIDlet-Icon, MIDlet-Description and MIDlet-Version
MIDlet-Jar-URL
Sign the application
jarsigner
jarsigner -keystore {mykeystore} -storepass (mypassword} {myjar} {myalias}
MIDlet-Jar-Size
in your JADJadTool.jar
from the WTKjava -jar JadTool.jar -addcert -alias {myalias} -storepass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}
JadTool.jar
java -jar JadTool.jar -addjarsig -alias {myalias} -jarfile {myjar} -storepass {mypassword} -keypass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}
Deployment
appear in your SMS Inbox
Installing the Certificate on the phone
this by right clicking the file and selecting "Send to Bluetooth Device",
you should be able to send files by cable or Infra Red (IR) too. NB: I
haven't found anyway of importing a certificate on a Series 40 phone
"Application Installation". On my phone (Nokia 6680) this is under
Tools->Settings->Certificate Management->Trust Settings, I turned on
everything but I think "Application Installation" is all you need
Common Problems
MIDlet-Permissions
can cause problems but it seems ok to me on Nokia 6680/6630/6230i (could be firmware dependent?)MIDlet-Permissions
attribute is the cause of a lot of problems (especially since the documentation is often wrong/missing or different depending on the phone), try leaving it out first and add permissions in one at a time. Some phones will complain about permissions they don't support, some will ignore themTrust Domains
Network Access: Not Allowed, Ask every time, Ask first time
Messaging: Not Allowed, Ask every time App
Auto-Start: Not Allowed, Ask every time, Ask first time
Connectivity: Not Allowed, Ask every time, Ask first time, Always allowed
Multimedia: Not Allowed, Ask every time, Ask first time
Read User Data: Not Allowed, Ask every time, Ask first time, Always allowed
Edit User Data: Not Allowed, Ask every time, Ask first time, Always allowed
Unresolved Problems
Sample JAD
Sample Manifest
Sample Ant Build File
I've put our EC1M ant build file up on our website to (hopefully) make all this a little easier for you.
Other Resources
This FAQ on the Nokia Forum is worth a read.
步骤一:
创建可能由步骤 2 提出的 CSR 请求
:
将您的信息提供给证书颁发机构进行验证。
步骤3:
您将获得用于代码签名的证书。
步骤4:
您需要下载中间证书和根证书。
步骤5:
现在您将拥有 your_domain_name.crt、IntCertCA.crt、TrustedRoot.crt
第 6 步:
将私钥导入您的your_domain_name.pem
步骤7:
从output_file_name.p12创建密钥库
第8步:
注意:请在触发以下命令之前备份您的 JAD 文件。
步骤9:
注意:请在触发以下命令之前备份您的 JAD 文件。
Step1:
Create CSR request which may be raised by
Step2:
Give your information to certificate authority for verification.
Step3:
You will be provided a certificate for code signing.
Step4:
You need to down load intermediate certificate along with root certificate.
Step5:
Now you will be having your_domain_name.crt, IntCertCA.crt, TrustedRoot.crt
Step6:
Import private key into your your_domain_name.pem
Step7:
Create keystore from output_file_name.p12
Step8:
NOTE: PLEASE TAKE BACKUP OF YOUR JAD FILE BEFORE TRIGGERING FOLLOWING COMMANDS.
Step9:
NOTE: PLEASE TAKE BACKUP OF YOUR JAD FILE BEFORE TRIGGERING FOLLOWING COMMANDS.