java 此 jar 包含签名者证书将在六个月内到期的条目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10405307/
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-31 00:55:03  来源:igfitidea点击:

This jar contains entries whose signer certificate will expire within six months

javasecurityappletcode-signing

提问by David

I've signed my jar in various ways, but I keep getting the above error message when I use the command:

我已经以各种方式对我的 jar 进行了签名,但是当我使用以下命令时,我不断收到上述错误消息:

jarsigner -verify -verbose [my jar]

Is there a way to get rid of this error? Will my code just stop working after six months if it's not re-certified?

有没有办法摆脱这个错误?如果没有重新认证,我的代码会在六个月后停止工作吗?

Here is the entire set of commands used to generate the key & sign the Jar:

这是用于生成密钥和对 Jar 签名的整套命令:

keytool -genkey -keystore [keystore] -alias [alias] -validity 2000
keytool -selfcert -keystore [keystore] -alias [alias] -validity 2000
jarsigner -keystore [keystore] [jar] [alias]

回答by Andrew Thompson

Is there a way to get rid of this error?

有没有办法摆脱这个错误?

It is not an error, but a warning. As to how to avoid it, make sure the certificate has a validity date that is longer than 6 months. For a self-signed certificate, that is a matter of providing the correct parameters when generating the key. Here is the keytoolExample.

这不是错误,而是警告。至于如何避免,请确保证书的有效期大于 6 个月。对于自签名证书,这是在生成密钥时提供正确参数的问题。这是keytool示例

keytool -genkeypair -dname "cn=Mark Jones, ou=Java, o=Oracle, c=US"
  -alias business -keypass <new password for private key> -keystore /working/mykeystore
  -storepass <new password for keystore> -validity 180

The important part is -validity 180. 180 days, or around 6 months, for that example. Use 1800 for around 5 years.

重要的部分是-validity 180。例如,180 天,或大约 6 个月。使用 1800 大约 5 年。

Will my code just stop working after six months if it's not re-certified?

如果没有重新认证,我的代码会在六个月后停止工作吗?

Not exactly.

不完全是。

  • The user on some systems will be warned that the certificate has expired, and be offered the choice to accept it. If they do, it will work as normal. e.g. of "signature has expired":
  • Other systems might be configured to automatically reject out of date certificates. On those machines, the code will most likely never start, or in rare cases, be loaded but have a sand-box applied.
  • 某些系统上的用户将被警告证书已过期,并提供接受它的选择。如果他们这样做,它将正常工作。例如“签名已过期”:
  • 其他系统可能配置为自动拒绝过时的证书。在这些机器上,代码很可能永远不会启动,或者在极少数情况下,会加载但应用了沙箱。


I thought I had turned all java caching off though, as it's annoying when trying to develop.

我以为我已经关闭了所有的 Java 缓存,因为它在尝试开发时很烦人。

Applet caching during testing is a big problem. I try to avoid testing applets in the browser until absolutely necessary. There are 3 ways I know of to test applets that will not cache the classes.

测试期间的小程序缓存是一个大问题。在绝对必要之前,我尽量避免在浏览器中测试小程序。我知道有 3 种方法可以测试不会缓存类的小程序。

  1. AppletViewer
  2. An hybrid applet/application
  3. Appleteer(slightly better than applet viewer in some respects, I developed it a while ago)
  1. 小程序查看器
  2. 混合小程序/应用程序
  3. Appleteer(在某些方面比applet viewer略好,我前段时间开发的)