更改罐子的到期时间 [英] To change jar expiry time

查看:114
本文介绍了更改罐子的到期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将由证书签名的jar的到期日期更改为30天.因此,我按顺序执行(我为第一个命令提供了相关的输入).但是,尽管将-validity选项指定为30天,但jarsigner命令说该证书在6个月后失效(默认).我该如何改变这个主意?以下是我使用的命令列表

I need to change expiry date of jar being signed by a certificate to say 30 days. Hence I execute in sequence (I provide relevant inputs for the first command). But in-spite of the -validity option being given as 30 days, the jarsigner command says the certificate expires after 6 months(which is default). How can I change this any idea ? Below is the list of commands i use

keytool -genkey -keystore test -alias testAlias -validity 30 <br>
keytool -selfcert -alias testAlias -keystore test <br>
jarsigner -keystore "C:\test" "C:\some.jar" testAlias

推荐答案

您的密钥有效期为30天;未指定您正在生成并使用该密钥签名的证书,因此默认为180天. 在这里重要的是-selfcert命令中指定的-validity标志的值.我刚刚测试了这个:

Your key has a validity of 30 days; the certificate that you are generating and signing with that key is not being specified, and so defaults to 180 days. It is the value of the -validity flag specified in the -selfcert command that is important here. I just tested this:

cp myKeystore myKeystore-TEST
keytool -selfcert -validity 30 -alias myAlias -keystore myKeystore-TEST
jarsigner -keystore myKeystore-TEST myApplet.jar myAlias

,然后当浏览器弹出对话框时,我可以验证过期日期是今天+ 30天. jarsigner -verbose -certs -verify myApplet.jar更详细,列出证书和密钥的摘要:

and when the browser popped up the dialog, I could verify that the expiration date was listed as today+30 days. jarsigner -verbose -certs -verify myApplet.jar is much more verbose, listing summary of the certificate and the key as well:

sm       697 Thu Dec 01 04:02:34 EST 2011 applet/Main.class

  X.509, CN=Todd Kaufmann, OU=Unknown, O=..., L=Pittsburgh, ST=PA, C=US
  [certificate will expire on 12/31/11 12:48 PM]

  X.509, CN=Todd Kaufmann, OU=Unknown, O=..., L=Pittsburgh, ST=PA, C=US
  [certificate will expire on 1/23/12 4:08 AM]
...
s = signature was verified
m = entry is listed in manifest

现在12/31/11是我的测试的30天,另一个日期是我创建密钥库的90天,我可以使用keytool -v -list -keystore myKeystore-TEST进行验证. keytool的手册页上说90天是密钥的默认设置.

Where 12/31/11 is 30 days from my test now, and the other date is 90 days after I created the keystore, which I can verify with keytool -v -list -keystore myKeystore-TEST. The man page for keytool says 90 days is the default for keys.

这篇关于更改罐子的到期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆