gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 03:22:42 27 4
gpt4 key购买 nike

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 安全性如此密切相关的过程却很少有文档记录,所以我担心这可能被认为是我不应该使用的“内部”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.

关于java - java.util.jar.JarFile 的 "verify"参数到底是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30965400/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com