feiggle
发贴: 70
积分: 20
|
于 2003-04-21 14:55
menzy wrote: 周末抽空看了一下java文档,可能用java.util.jar也可以解决这些问题
也看了一下,java.util.jar包可以完成对jar包的灵活操作,可以将每个class文件 读成流,然后对其进行message digest,正在试验中,但是我估计不行,因为 有两点原因: 1)如果用standard message digest,对每个class文件update后的message digest应写到什么地方?因为我们希望这个文件能够包含在jar包中; 2)如果用mac,除了存在第一条的问题外,还存在secretkeys和secret passphrase的管理问题,有点类似数字签名的证书分发管理的问题,这样又将问题复杂 化了; 原来这个问题,我已经用从jar包中得到certs来判断此jar包的合法性,已经做出来了,但是作为技术问题,这种思路,还是有讨论的必要的,可以使我们理解的更加深刻。 个人觉得:正如floater所说: 1)You can't! If you do a md5, then any modification could invalidate this value and thus you can't put this value(in a file) in the jar. That's why md5 digest is always seperated from the package.(Linux packages tend to have this file to be verified by the downloaders.) 2) I don't know how many ways to verify a package's integrity, but the most commonly used method I have seen is this md5, with the digest outside the package. 可能这种方法从一开始就是不通的。 thanks!
feiggle edited on 2003-04-21 14:59
|