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) 2006-2011 Schlichtherle IT Services
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package de.schlichtherle.truezip.fs.archive.zip.raes;

import de.schlichtherle.truezip.fs.FsModel;
import de.schlichtherle.truezip.fs.archive.zip.ZipArchiveEntry;
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 edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.IOException;
import java.io.OutputStream;
import net.jcip.annotations.Immutable;

/**
 * A paranoid archive driver which builds 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. * * @see SafeZipRaesDriver * @author Christian Schlichtherle * @version $Id$ */ @Immutable @DefaultAnnotation(NonNull.class) 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, @CheckForNull ZipInputShop source) throws IOException { return new ZipOutputShop(this, model, out, source); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy