我有一个 Java Web Start 应用程序,其中包含多个 JAR 库。现在我需要对 JAR 进行签名才能使其通过浏览器运行。
我的问题是:除了主要的 Jar 签名之外,我是否还需要对应用程序内的每个库 JAR 进行签名?
最佳答案
想象一下,如果您有一个农场并饲养有值(value)的鸵鸟。为了防止鸵鸟走失并被狮子吃掉,你在农场周围竖起了栅栏。但不幸的是,你只有足够的栅栏铁丝来围绕农场 4 个边中的 3 个边设置栅栏。鸵鸟(以及您的投资)安全吗?当然不是。
安全也是同样的原理。 任何未经数字签名的库 Jar 都是安全漏洞的潜在来源。通向底线..
应用程序中的每个 Jar。必须在应用程序之前进行数字签名。可以被认为是安全且值得信赖的。
..if I sign libraries that are already signed will the new signature override the old one?
不一定。来自 jarsigner
docs: Multiple Signatures for a JAR File我们看到..
Multiple Signatures for a JAR File
A JAR file can be signed by multiple people by running the jarsigner command on the file multiple times and specifying the alias for a different person each time, as follows:
jarsigner myBundle.jar susan
jarsigner myBundle.jar kevin
When a JAR file is signed multiple times, there are multiple .SF and .DSA files in the resulting JAR file, one pair for each signature. In the previous example, the output JAR file includes files with the following names:
SUSAN.SF
SUSAN.DSA
KEVIN.SF
KEVIN.DSA
关于Java Web Start Sign 库 Jars,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27385736/