简体   繁体   English

为什么Java Web Start说签名的jar文件是未签名的?

[英]Why does Java Web Start say a signed jar file is unsigned?

Java Web Start (JWS) says that it can't launch my application because the jar file is unsigned: Java Web Start(JWS)说它无法启动我的应用程序,因为jar文件是无符号的:

Error: Unsigned application requesting unrestricted access to system
       Unsigned resource: .../dynaccn.jar

But the jar file is signed: 但jar文件签名:

$ jarsigner -keystore ... dynaccn.jar idv
$ jar tf dynaccn.jar
META-INF/MANIFEST.MF
META-INF/IDV.SF
META-INF/IDV.RSA
META-INF/
edu/
edu/ucar/
edu/ucar/unidata/
edu/ucar/unidata/dynaccn/
App$1.class
...
$ jarsigner -verbose -certs -verify dynaccn.jar
       28325 Tue Aug 17 09:41:58 MDT 2010 META-INF/MANIFEST.MF
       28404 Tue Aug 17 09:41:58 MDT 2010 META-INF/IDV.SF
        2880 Tue Aug 17 09:41:58 MDT 2010 META-INF/IDV.RSA
           0 Tue Aug 17 09:41:58 MDT 2010 META-INF/
           0 Mon Aug 16 10:10:34 MDT 2010 edu/
           0 Mon Aug 16 10:10:34 MDT 2010 edu/ucar/
           0 Mon Aug 16 10:10:34 MDT 2010 edu/ucar/unidata/
           0 Mon Aug 16 10:10:34 MDT 2010 edu/ucar/unidata/dynaccn/
...
sm       486 Mon Aug 16 10:10:34 MDT 2010 App$1.class

      X.509, CN=University Corporation for Atmospheric Research, OU=UNIDATA, O=University Corporation for Atmospheric Research, L=Boulder, ST=Colorado, C=US
      [certificate will expire on 2/6/11 4:59 PM]
      X.509, CN=Thawte Code Signing CA, O=Thawte Consulting (Pty) Ltd., C=ZA
      [certificate is valid from 8/5/03 6:00 PM to 8/5/13 5:59 PM]
      [KeyUsage extension does not support code signing]
      X.509, EMAILADDRESS=premium-server@thawte.com, CN=Thawte Premium Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA
      [certificate is valid from 7/31/96 6:00 PM to 12/31/20 4:59 PM]
      [CertPath not validated: null]
...
jar verified.

Warning: 
This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing.
This jar contains entries whose signer certificate will expire within six months. 
This jar contains entries whose certificate chain is not validated.
This jar contains signed entries that's not signed by alias in this keystore.

and both JWS and my browser have a certificate for "Thawte Premium Server CA". JWS和我的浏览器都有“Thawte Premium Server CA”证书。

The problem occurs even if the JWS cache and the browser download area are empty. 即使JWS缓存和浏览器下载区域为空,也会出现此问题。

I don't believe the "KeyUsage" message is relevant because 1) the same certificate chain is used for another application that does launch successfully; 我不相信“KeyUsage”消息是相关的,因为1)相同的证书链用于另一个成功启动的应用程序; and 2) documentation I've read indicates that the Thawte Code Signing CA is only used to verify the UNIDATA certificate and not to sign code. 2)我读过的文档表明Thawte Code Signing CA仅用于验证UNIDATA证书而不用于签署代码。

My environment is Linux 2.6.27.41-170.2.117.fc10.x86_64, Firefox 3.6.8 (i686), and Java 1.7.0-ea. 我的环境是Linux 2.6.27.41-170.2.117.fc10.x86_64,Firefox 3.6.8(i686)和Java 1.7.0-ea。

Why won't this application launch? 为什么这个应用程序不会启动?

UPDATE: I've discovered that the application launches if the "codebase" attribute in the JNLP file references a local directory but not if it references a URL that lies behind user authentication. 更新:我发现如果JNLP文件中的“codebase”属性引用本地目录,则启动应用程序,但如果它引用了位于用户身份验证之后的URL,则不会启动。 In the latter case, javaws(1) interprets the authentication webpage as a JNLP file (with obvious results) if invoked from the command-line. 在后一种情况下,如果从命令行调用,javaws(1)将认证网页解释为JNLP文件(具有明显的结果)。 If invoked by the "deployJava" script from a user-authenticating webpage (so that the browser has a session cookie), then javaws(1) says that the application isn't signed. 如果来自用户身份验证网页的“deployJava”脚本调用(以便浏览器具有会话cookie),则javaws(1)表示该应用程序未签名。 I find both of these failure modes odd as the javaws(1) documentation says that it understands user authenticating web pages and the jar file is signed. 我发现这两种失败模式都很奇怪,因为javaws(1)文档说它理解用户验证网页并且jar文件已签名。

I'm on Gentoo Linux, running OpenJDK 7, and I think I experienced the same problem. 我在Gentoo Linux上运行OpenJDK 7,我认为我遇到了同样的问题。

I could not get it to work with OpenJDK 7. Only re-signing with a release of the Sun Java 6 JDK ultimately signed the application correctly. 我无法使用它与OpenJDK 7一起使用。只有使用Sun Java 6 JDK版本重新签名才能正确签署应用程序。 (I also re-built it all due to it being managed by ant, I don't know if that is necessary, though). (我也重新构建了它,因为它是由ant管理的,但我不知道是否有必要)。

Merely switching to the official JDK 6 without rebuilding only makes the "[CertPath not validated: null]" warning when varifying with "jarsigner -verify -verbose -certs" disappear, but does not appear to work in the application I ultimately use. 仅仅切换到官方JDK 6而不进行重建只会使用“jarsigner -verify -verbose -certs”进行变换时“[CertPath not validated:null]”警告消失,但在我最终使用的应用程序中似乎不起作用。

  1. make sure you are not using a cached (unsigned) version of the jar. 确保你没有使用jar的缓存(unsigned)版本。 Clean the temp folder where JWS downloads jars 清理JWS下载jar的临时文件夹
  2. make sure that all dependencies (jars) of your jar, that require special permissions, are also signed 确保您的jar的所有依赖项(jar)需要特殊权限,也会被签名

Make sure you wrap your calls in the applet with a doPrivileged block. 确保使用doPrivileged块将调用包装在applet中。 I am unsure why it works like this but seems to work like a charm. 我不确定为什么它会像这样工作,但似乎像一个魅力。

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

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