java Keytool 和 jarsigner 工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4282405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 05:40:30  来源:igfitidea点击:

Keytool and jarsigner tool

javakeytooljarsigner

提问by user469999

I have developed a blackberry application which I have loaded in the BB device. But as we know, without signing the application with RIM we can't run the application on the device. Is there any way which I can create the trial version of my application for some days and run it in the device for testing purposes.

我开发了一个黑莓应用程序,它已加载到 BB 设备中。但是我们知道,如果不使用 RIM 签署应用程序,我们就无法在设备上运行应用程序。有什么方法可以让我在几天内创建我的应用程序的试用版并在设备中运行它以进行测试。

I have heard about the "keytool" and "jarsigner" tools. Can this tools help me to run my application in device without signing the application? If yes, please give me the steps regarding how it can be done.

我听说过“keytool”和“jarsigner”工具。这个工具可以帮助我在设备中运行我的应用程序而不签署应用程序吗?如果是,请给我有关如何完成的步骤。

回答by

The steps to sign a java archive (.jar file).

签署 java 档案(.jar 文件)的步骤。

  1. First create the public key with keytool program:
    keytool -genkey -alias <alias name> -keystore <key file> (http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html).

  2. Then sign the java archive package:
    jarsigner -keystore <key file> -storepass <password 1 from steps before> -keypass <password 2 from steps before> -sigfile <the name of files .DSA .SF> -certs <java archive file name> <alias name> (http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/jarsigner.html).

  1. 首先用keytool程序创建公钥:
    keytool -genkey -alias <别名> -keystore <key file> ( http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html)。

  2. 然后对 java 存档包进行签名:
    jarsigner -keystore <key file> -storepass <password 1 from steps before> -keypass <password 2 from steps before> -sigfile <the name of files .DSA .SF> -certs <java archive file名称> <别名> ( http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/jarsigner.html)。