All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.schlichtherle.truezip.fs.archive.zip.raes.ParanoidZipRaesDriver Maven / Gradle / Ivy

/*
 * Copyright (C) 2005-2015 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package de.schlichtherle.truezip.fs.archive.zip.raes;

import de.schlichtherle.truezip.fs.FsModel;
import de.schlichtherle.truezip.fs.archive.zip.ZipDriverEntry;
import de.schlichtherle.truezip.fs.archive.zip.ZipInputShop;
import de.schlichtherle.truezip.fs.archive.zip.ZipOutputShop;
import de.schlichtherle.truezip.key.KeyManagerProvider;
import de.schlichtherle.truezip.socket.IOPoolProvider;
import de.schlichtherle.truezip.socket.OutputShop;
import java.io.IOException;
import java.io.OutputStream;
import javax.annotation.concurrent.Immutable;

/**
 * A paranoid archive driver for RAES encrypted ZIP files.
 * This driver always checks the cipher text of input archive files
 * using the RAES Message Authentication Code (MAC), which makes it slower than
 * the {@link SafeZipRaesDriver} for archive files larger than 512 KB and
 * may pause the client application on the first access to the archive file
 * for a while if the file is large.
 * Note that the CRC-32 value of the plain text ZIP file is never checked
 * because this is made redundant by the MAC verification.
 * 

* In addition, this driver limits the number of concurrent entry output * streams to one, so that writing unencrypted temporary files is inhibited. *

* Subclasses must be thread-safe and should be immutable! * * @see SafeZipRaesDriver * @author Christian Schlichtherle */ @Immutable public class ParanoidZipRaesDriver extends ZipRaesDriver { public ParanoidZipRaesDriver( IOPoolProvider ioPoolProvider, KeyManagerProvider keyManagerProvider) { super(ioPoolProvider, keyManagerProvider); } @Override public final long getAuthenticationTrigger() { return Long.MAX_VALUE; } /** * This implementation returns a new {@link ZipOutputShop}. * This restricts the number of concurrent output entry streams to one in * order to inhibit writing unencrypted temporary files for buffering the * written entries. */ @Override protected OutputShop newOutputShop( FsModel model, OutputStream out, ZipInputShop source) throws IOException { return new ZipOutputShop(this, model, out, source); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy