Java代码签名证书申请和使用指南
第1步 下载签名工具 Step 1: Download Signing Tools
如果您还没有签名工具,请到SUN公司网站免费下载:http://java.sun.com/j2se/,推荐下载JDK1.4.2或以上版本,支持Solaris SPARC/x86, Linux86 和 Windows 操作系统。
          If you have not already done so, download the Java 2 Software
Development Kit (SDK). The latest version is available free of charge
for the Solaris SPARC/x86, Linux86, and Microsoft Windows platforms
from http://java.sun.com/j2se/.
您将使用签名工具中的 keytool, jar, jarsigner 来申请代码签名证书和数字签名您的代码。 
          You will be using the keytool, jar, and jarsigner to apply for your Code Signing Certificate and sign your code.
第2步 申请签名证书 Step 2: Enrollment (如果您没有证书,请联系易维信(EVTrust)申请)
(1) 生成私钥和公钥对(Keystore) Create a Keystore
使用以下命令生成私钥和公钥对: 
          To generate a public/private key pair, enter the following
command, specifying a name for your keystore and an alias as well.
c:\jdk1.5\bin\keytool -genkey -keyalg rsa -keystore <keystore_filename> -alias <alias_name>
Keytool 会提示您输入私钥密码、您的姓名(Your
name,填单位网址)、您的部门名称、单位名称、所在城市、所在省份和国家缩写(中国填:CN,其他国家填其缩写),单位名称一定要与证明文件上的名称
一致,部门名称(OU)可以不填。除国家缩写必须填CN外,其余都可以是英文或中文。请一定要保存好您的私钥和私钥密码。我们不会要求您提供私钥文件!
          Keytool prompts you to enter a password for your keystore,
your name, organization, and address. The public/private key pair
generated by keytool is saved to your keystore and will be used to sign
Java Applets and applications. This key is never sent to GlobalSign and
is required to sign code. GlobalSign encourages you to make a copy of
the public/private key pair and store it in a safe deposit box or other
secure location. If the key is lost or stolen, contact GlobalSign
immediately to have it revoked.
(2) 生成证书请求文件(CSR) Generate a CSR
请使用如下命令生成证书请求文件(CSR): 
          You need to generate a Certificate Signing Request (CSR) for
the enrollment process, the following command requests Keytool to create
 a CSR for the key pair in the keystore:
c:\jdk1.5\bin\keytool –certreq –file certreq.csr –keystore <keystore_filename> -alias <alias_name>
请把生成的certreq.csr 文件复制和粘贴到GlobalSign证书在线申请页面的CSR文本框中,或直接发给维瑞客服,请等待1-2个工作日后颁发证书。
          Copy the contents of the CSR and paste them directly into the
维瑞信 enrollment form. Open the file in a text editor that does not add
extra characters (Notepad or Vi are recommended).
第3步 使用代码签名证书 Step 3: Begin Using
(1) 导入签名证书 Import GlobalSign Codesigning Certificate
一旦GlobalSign验证了您的真实身份,将会颁发证书给您。您需要到GlobalSign网站下载您的证书,请选择
PKCS #7 格式证书(PKCS #7 Certificate Chain),此证书格式含有您的证书和根证书链,Keytool要求此格式证书
,请把证书保存到您的电脑中。
          Once GlobalSign has verified your identity, we will send a
confirmation e-mail with your Sun Java Code Signing Certificate
attached. Upon receipt, the attached Code Signing Certificate is saved
to a file on your computer. A Code Signing Certificate is a "trust path"
 or "chain" back to the GlobalSign root certificate. This "trust path"
allows your code to be validated on any standard JRE without installing
any additional files.
请使用如下命令导入您的证书到keystore 中,这里假设您的证书名称为:cert.cer,请同时指明详细路径,一旦成功导入证书,请及时备份您的keystore文件: 
          To import your Sun Java Signing Code Signing Certificate into
your keystore, enter the following code with the path correct name for
your file (for example, “cert.cer”).
c:\jdk1.5\bin\keytool -import –trustcacerts –keystore <keystore_filename> -alias <alias_name> -file cert.cer
(2) 把Applet代码打包成JAR文件 Bundle Applet into a JAR File
请使用jar 把您的Java代码打包成JAR文件,此JAR文件包含了当前目录及其子目录的所有Applet文件: 
          Use jar to bundle your Applets or applications as a JAR file.
This string creates a JAR file C:\TestApplet.jar. The JAR file contains
all the files under the current directory and its sub-directories.
c:\jdk1.5\bin\jar cvf C:\TestApplet.jar
运行后, Jar会显示: Jar responds:
added manifest 
          adding: TestApplet.class (in = 94208) (out= 20103)(deflated 78%) 
          adding: TestHelper.class (in = 16384) (out= 779)(deflated 95%)
(3) 数字签名Applet Sign Your Applet
使用jarsigner签名您的JAR文件,最后的参数Mycert为Keystore中签名证书的别名:
          Use jarsigner to sign the JAR file with the private key you saved in your keystore.
c:\jdk1.5\bin\jarsigner C:\TestApplet.jar MyCert
(a) 会提示您输入私钥密码,请使用您在第1步设置的密码;
          At the prompt, enter the password to your keystore.
(b) 请输入.jar文件的完整路径和文件名,MyCert 就是您在生成私钥和CSR时使用的别名<alias_name>;
          In the command syntax, TestApplet represents the name and
location of your JAR file. MyCert must specify the same value that you
used when generating the key pair and certificate signing request (CSR).
(c) Jarsigner 会生成您的代码摘要(Hash),并把此摘要和您的签名证书添加到JAR文件中。
          Jarsigner hashes your Applet or application and stores the
hash in the JAR file with a copy of your Code Signing Certificate.
如果您已经有了从其他电脑上备份的Keystore文件(如:wotonecs.jks),则可以使用如下命令来签名JAR文件,最后的参数wotonecs为Keystore中签名证书的别名:
c:\jdk1.5\bin\jarsigner -keystore wotonecs.jks C:\TestApplet.jar wotonecs
(d) 使用以下命令验证已经签名的JAR文件 Verify the output of your signed JAR file.
c:\jdk1.5\bin\jarsigner -verify -verbose -certs c:\TestApplet.jar
一旦成功签名,就可以把已经签名的JAR文件放到网上供用户下载了,用户端的Java系统会显示您的签名证书信息,如果已经签名的文件被篡改或损坏,则系统会提醒用户并拒绝安装。 
          When the signed JAR file is downloaded, the Java Runtime
Environment will display your certificate to the user. If the file is
tampered with in any way after it has been signed, the user will be
notified and given the option to refuse installation.
Java代码签名证书申请和使用指南的更多相关文章
- Thawte 企业版代码签名证书
		Thawte企业版代码签名证书 ,严格验证企业身份,如果您是个人开放者,请申请Thawte 个人代码签名证书.Thawte企业代码签名证书 可帮助程序开发者使用微软代码签名工具(Microsoft ... 
- Adobe AIR 代码签名证书使用指南
		Symantec,Thawte,GlobalSign 签发的代码签名证书都可以签名AIR文件.如果您还没有代码签名证书,请联系易维信(EVTrust)购买Adobe AIR 代码签名证书. 1.签名工 ... 
- Win10内核驱动强制签名,申请沃通 EV代码签名证书
		2016年7月,微软在MSDN宣布从Windows 10的1607版本开始,强制要求所有新的Win10 内核驱动程序,必须获得Windows硬件开发者中心仪表盘门户的数字签名才能在系统中运行.这项政策 ... 
- 使用Symantec代码签名证书对代码进行签名的 5 个理由
		借助 Symantec Code Signing,在更多平台上将您的代码提供给更多客户,我们总结了5大理由告诉软件开发者在发布自己的软件时一定要购买Symantec 代码签名证书签名即将发布的软件. ... 
- Windows 硬件开发人员怎样选择代码签名证书类型
		在建立 Windows 开发人员中心硬件仪表板帐户之前,你需要获取代码签名证书以保护数字信息的安全.此证书是用于建立你的公司对你所提交代码的所有权的接受标准.它让你可以用数字形式签署 PE 二进制文件 ... 
- 沃通SSL证书、代码签名证书应用于机器人安全防护
		近两年,扫地机器人.智能音箱等消费级机器人产品逐渐走入大众生活的中.随着人工智能技术的迅猛发展,预计2023年全球消费级机器人市场规模将达到150亿美元.然而,产业的迅猛发展却伴随着安全防护的缺失,安 ... 
- 使用XCA(X Certificate and key management)可视化项目经理SSL 凭证(4)--凭借自身的凭证管理中心的定义(Certificate Authority)签名证书申请
		随着XCA(X Certificate and key management)可视化项目经理SSL 证书系列文章(2)和(3)中.我们学习了怎样用XCA(X Certificate and key m ... 
- MQTT研究之EMQ:【JAVA代码构建X509证书】
		这篇帖子,不会过多解释X509证书的基础理论知识,也不会介绍太多SSL/TLS的基本信息,重点介绍如何用java实现SSL协议需要的X509规范的证书. 之前的博文,介绍过用openssl创建证书,并 ... 
- MDM证书申请的流程
		MDM证书申请的流程 整个流程分为两部分:vendor,customer. 一.Vendor 1.成为一个 MDM Vendor 1) 首先你需要拥有一个 Apple Enterprise accou ... 
随机推荐
- WIN7或2008远程连接特别慢的解决方法  【转】
			方法一. 原因在于从vista开始,微软在TCP/IP协议栈里新加了一个叫做“Window Auto-Tuning”的功能.这个功能本身的目的是为了让操作系统根据网络的实时性能,(比如响应时间)来动态 ... 
- FTPClient用法
			某些数据交换,我们需要通过ftp来完成. sun.net.ftp.FtpClient 可以帮助我们进行一些简单的ftp客户端功能:下载.上传文件. 但如遇到创建目录之类的就无能为力了,我们只好利用 ... 
- 使用Toolbar + DrawerLayou实现菜单侧滑,改变toolbar左上角图标
			侧边栏具体实现可以参照http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0303/2522.html getSupportActio ... 
- Sql里时间加减
			简单的时间加减 DATEADD(dd,-30, GETDATE())) 使用DateADD方法: 参数1:间隔,表示要添加的时间间隔,一天还是一月还是一年 参数2:要加或减的个数,加一年或加一月 参数 ... 
- SQL去除重复记录
			SQL去除重复记录 if not object_id('Tempdb..#T') is null drop table #T Go Create table #T([ID] int,[Name ... 
- openstack kolla 部署---不同的节点采用不同的物理接口
			在 /etc/kolla/globals.yml 文件中删除 neutron_external_interface tunnel_interface api_interface storage_ ... 
- “全栈2019”Java第一百一十三章:什么是回调?回调应用场景详解
			难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ... 
- MysqliDb 库的一些使用简单技巧(php)
			一.分页功能 假设接口要接受输入:page, page_limit,key,value,table 来查询 table 中 key like value 的元组中以 page_limit 为 page ... 
- javascript获取wx.config内部字段解决微信分享
			转自:http://www.jb51.net/article/80679.htm 专题推荐:js微信开发_脚本之家 http://www.jb51.net/Special/879.htm 背景在微信分 ... 
- Postgres中的SpinLock锁
			我们知道,在数据库中为了并发控制,少不了要使用各种各样的锁(lock).PostgreSQL中也不例外. 在PostgreSQL中有三种级别的锁,他们的关系如下: |上层 RegularLock | ... 
