繁体   English   中英

证书过期时Java Web Start application (signed without timestamp)会发生什么?

[英]What happens to Java Web Start application (signed without timestamp) when certificate expires?

我们有一个 Java Web 使用 CA (Thawte) 的证书签名的启动应用程序。 该应用程序分发给数百名客户。 他们将它托管在他们的服务器上,然后在他们的客户端计算机上通过 Internet 或 Intranet 运行它。 现在它完美无缺。 问题是应用程序是在没有时间戳的情况下签名的。 证书过期后客户会怎样? 他们应该能够启动应用程序吗? 如果没有,我们如何帮助他们? 将他们的服务器 URL 添加到异常站点列表对他们有帮助吗?

我们试图更改本地时间以假装证书过期。 然后由于安全原因,应用程序被阻止。 将 URL 添加到异常站点列表没有帮助:

java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Response is unreliable: its validity interval is out-of-date
at com.sun.deploy.security.RevocationChecker.checkOCSP(Unknown Source)
at com.sun.deploy.security.RevocationChecker.check(Unknown Source)
at com.sun.deploy.security.TrustDecider.checkRevocationStatus(Unknown Source)
at com.sun.deploy.security.TrustDecider.getValidationState(Unknown Source)
at com.sun.deploy.security.TrustDecider.validateChain(Unknown Source)
at com.sun.deploy.security.TrustDecider.isAllPermissionGrantedInt(Unknown Source)
at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Suppressed: com.sun.deploy.security.RevocationChecker$StatusUnknownException
    at com.sun.deploy.security.RevocationChecker.checkCRLs(Unknown Source)
    ... 19 more
Caused by: java.security.cert.CertPathValidatorException: Response is unreliable: its validity interval is out-of-date
at sun.security.provider.certpath.OCSPResponse.verify(Unknown Source)
at sun.security.provider.certpath.OCSP.check(Unknown Source)
at sun.security.provider.certpath.OCSP.check(Unknown Source)
at sun.security.provider.certpath.OCSP.check(Unknown Source)
at com.sun.deploy.security.RevocationChecker$2.run(Unknown Source)
at com.sun.deploy.security.RevocationChecker$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.RevocationChecker.doPrivilegedOCSPCheck(Unknown Source)
... 20 more

我们能做什么? 当然,我们要求 Thawte 更新我们的证书,并要求我们的客户升级到已辞职的应用程序。 但我们无法涵盖所有这些。 当他们问我们时,我们需要为他们提供一些快速的建议。 到期时间快到了,欢迎大家发表意见。

怎么了?

WebStart的行为在很大程度上取决于它所属的JRE版本。

这些是我们的测试结果,其中的应用程序带有来自官方证书颁发机构的有效证书签名,但证书过期后没有时间戳。 通过在不同版本中直接执行javaws.exe并更改系统时钟以进行仿真,在带有x64 JRE的Windows 7上进行了测试:

  • <= 7u21:警告消息(可以用复选框隐藏)
  • 7u25-7u40:WebStart以不同的方式损坏,在每个更新版本中更改行为,无论如何都不要使用
  • 7u45至7u51:应用程序在安全设置“非常高”下被阻止,警告消息在“高”设置下(可以通过复选框隐藏)
  • > = 7u55:应用程序被阻止
  • > = 8u0:应用程序被阻止

我们注意到从浏览器启动时,WebStart尝试使用系统上当前安装的最新版本。 在浏览器中更改JNLP文件的应用程序是不够的(Firefox)。 有一种使用安装在Programm Files\\Java文件夹中的JRE和JDK的查找策略。 从命令行或Windows链接调用javaws.exe实际上会执行要测试的版本。 您可以在Java控制台(成功启动)或“任务管理器”命令行列(代表另一个版本的jp2launcher.exe )中jp2launcher.exe该版本。

解决方法

  • 对我们来说,例外站点列表确实有效(已通过j8u66测试)。 但是,输入正确的URL似乎很棘手。 我们认为它必须与JNLP文件URL中使用的URL完全相同。 当JNLP URL为http://myhost:12345/my/app/test.jnlp ,异常站点http://myhost:12345/可以正常工作。 使用myhostmyhost.in-my-domain.com的IP地址将不匹配。 请参阅http://java.com/de/download/faq/exception_sitelist.xml
  • 根据您的应用程序类型,创建到j7u21 ...\\javaws.exe <jnlp-url>的Windows桌面链接可能是一种解决方法。

带时间戳签名和警告

Oracle声明,从官方时间戳机构(TSA)进行时间戳签名将防止签名过期。 这使您可以防止将来的发行版中出现问题,并提供更新发行版。

请注意以下警告:即使签名证书已过期,WebStart也对带有时间戳的签名感到满意。 但是,它将在TSA证书过期时阻止该应用程序并显示“证书已过期或尚未生效”。 在我们的测试中,这是在2020-03-16使用TSA http://tsa.starfieldtech.com/ 您可以在keytool -printcert -jarfile <your-signed.jar>的输出中看到Timestamp:之后的到期日期。

时间戳记只能使您在此定时炸弹的时钟上再保留几年。 根据您的应用程序类型,这可能不是问题,但是对于必须在未来10年内运行的封闭环境中的嵌入式应用程序,这是一个杀手er。 (使用j8u66测试)

从2016年1月7日开始更新:Oracle支持机构对此问题的最终答案是“没有错误。此行为是预期的和有意的。绝对没有任何变化。” 这意味着存在并且将没有方法在没有到期的情况下对应用程序进行签名。

我只想补充一点,您在更改计算机时间时看到的异常与证书的到期无关。 OCSP 是一种用于在证书被撤销与否时调用服务器的协议。 OCSP 响应中有一个时间,如果您的计算机时钟距离响应时间超过 900 秒,则会发生此异常。 如果不操纵时钟,则不会发生此异常。

此片段来自 1.8u221 JRE sun.security.provider.certpath.OCSPResponse singleResponse 具有来自 OCSP 服务器的响应。

/*  591 */     long l = (paramDate == null) ? System.currentTimeMillis() : paramDate.getTime();
/*  592 */     Date date1 = new Date(l + MAX_CLOCK_SKEW);
/*  593 */     Date date2 = new Date(l - MAX_CLOCK_SKEW);
/*  594 */     for (SingleResponse singleResponse : this.singleResponseMap.values()) {
/*  595 */       if (debug != null) {
/*  596 */         String str = "";
/*  597 */         if (singleResponse.nextUpdate != null) {
/*  598 */           str = " until " + singleResponse.nextUpdate;
/*      */         }
/*  600 */         debug.println("OCSP response validity interval is from " + singleResponse
/*  601 */             .thisUpdate + str);
/*  602 */         debug.println("Checking validity of OCSP response on: " + new Date(l));
/*      */       } 
/*      */ 
/*      */ 
/*      */ 
/*      */ 
/*      */       
/*  609 */       if (date1.before(singleResponse.thisUpdate) || date2
/*  610 */         .after(
/*  611 */           (singleResponse.nextUpdate != null) ? singleResponse.nextUpdate : singleResponse.thisUpdate))
/*      */       {
/*  613 */         throw new CertPathValidatorException("Response is unreliable: its validity interval is out-of-date");
/*      */       }
/*      */     } 
/*      */   }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM