簡體   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