我有以下代码,可以在Android上使用zip4j读取加密的zip文件。我没有提供临时文件。 zip4j是否创建用于解密的临时文件?还是zip标准允许即时解密,因此不会将加密数据临时写入存储设备?

ZipFile table = null;
    try {
        table = new ZipFile("/sdcard/file.zip");
        if( table.isEncrypted() ){
            table.setPassword("password");
        }
    } catch (Exception e) {
        // if can't be opened then return null
        e.printStackTrace();
        return;
    }
    InputStream in = null;
    try {

        FileHeader entry = table.getFileHeader("file.txt");

        in = table.getInputStream(entry);
             ...

最佳答案

作为Zip4j的作者,我可以向您保证Zip4j不会创建任何用于解密的临时文件。

Zip4j将解密内存中的数据,并且不会将加密数据写入任何临时文件。 Zip格式规范允许对AES和标准Zip加密进行即时或内存中解密。

08-18 16:27