java.util.jar.JarFile 的 "verify" 参数到底是什么意思?

What does the "verify" parameter to java.util.jar.JarFile mean, precisely?

java.util.jar.JarFile 的构造函数采用 verify 参数,其唯一文档似乎是 the JavaDoc 中的这个短语:

verify - whether or not to verify the jar file if it is signed.

不过,这显然不是很准确。 JarFile 的验证过程是什么?它是否只验证 Jar 文件未被篡改,或者它是否也以某种未指定的方式验证签名者证书是否可信?如果验证失败,或者签名文件格式错误,会发生什么情况?验证是急切的还是懒惰的,&c&c?

我发现这样一个看起来与核心 Java 安全性如此密切相关的过程却缺乏记录,这通常很奇怪,所以我担心这可能被认为是 "internal" API 我真的不应该使用。是这样吗,或者我可能只是在某处遗漏了外部文档,还是只是一些奇怪的疏忽?

可能值得查看 最新 文档,而不是 2004 的文档。 :-)

up-to-date documentation中,它说:

If the verify flag is on when opening a signed jar file, the content of the file is verified against its signature embedded inside the file. Please note that the verification process does not include validating the signer's certificate. A caller should inspect the return value of JarEntry.getCodeSigners() to further determine if the signature can be trusted.