【发布时间】:2014-12-30 05:11:23
【问题描述】:
我正在开发一个用户提交一些存档样本的门户。我需要检查这些样本是否是受密码保护的压缩文件。我能够检测这些文件是否被压缩,但我被困在如何检查文件是否受密码保护。有人可以帮忙吗? 我正在使用 php。
【问题讨论】:
我正在开发一个用户提交一些存档样本的门户。我需要检查这些样本是否是受密码保护的压缩文件。我能够检测这些文件是否被压缩,但我被困在如何检查文件是否受密码保护。有人可以帮忙吗? 我正在使用 php。
【问题讨论】:
RAR technote中定义如下:
Archive header ( MAIN_HEAD )
HEAD_FLAGS Bit flags:
2 bytes
0x0040 - Recovery record present
0x0080 - Block headers are encrypted
0x0100 - First volume (set only by RAR 3.0 and later)
File header (File in archive)
HEAD_FLAGS Bit flags:
2 bytes
0x01 - file continued from previous volume
0x02 - file continued in next volume
0x04 - file encrypted with password
所以检查块上的那些标志。
【讨论】: