TrueZIP Driver ZIP.RAES (TZP) 7.1

de.schlichtherle.truezip.fs.archive.zip.raes
Class SafeZipRaesDriver

java.lang.Object
  extended by de.schlichtherle.truezip.fs.FsDriver
      extended by de.schlichtherle.truezip.fs.archive.FsArchiveDriver<E>
          extended by de.schlichtherle.truezip.fs.archive.FsCharsetArchiveDriver<ZipArchiveEntry>
              extended by de.schlichtherle.truezip.fs.archive.zip.ZipDriver
                  extended by de.schlichtherle.truezip.fs.archive.zip.JarDriver
                      extended by de.schlichtherle.truezip.fs.archive.zip.raes.ZipRaesDriver
                          extended by de.schlichtherle.truezip.fs.archive.zip.raes.SafeZipRaesDriver
All Implemented Interfaces:
ZipEntryFactory<ZipArchiveEntry>

@Immutable
public class SafeZipRaesDriver
extends ZipRaesDriver

A safe archive driver which builds RAES encrypted ZIP files (ZIP.RAES). For input archive files up to 512 KB, the cipher text gets authenticated using the RAES provided Message Authentication Code (MAC) before the archive can be accessed by a client application. For larger input archive files, the MAC is not used, but instead the CRC-32 value of the decrypted and deflated archive entries is checked when the archive entry stream is closed by the client application, resulting in some IOException.

This operation mode is considered to be safe: Although a formal prove is missing, it should be computationally infeasible to modify an archive file so that after decryption of the archive and after inflation (decompression) of an entry's data its CRC-32 value still matches! This should hold true even though CRC-32 is not at all a good cryptographic hash function because of its frequent collisions, its linear output and small output size. It's the ZIP inflation algorithm which actually comes to our rescue!

Author:
Christian Schlichtherle
See Also:
ParanoidZipRaesDriver

Nested Class Summary
 
Nested classes/interfaces inherited from class de.schlichtherle.truezip.fs.archive.zip.raes.ZipRaesDriver
ZipRaesDriver.KeyProviderSyncStrategy
 
Field Summary
private static long AUTHENTICATION_TRIGGER
          The default trigger for authentication in bytes (524288L).
 
Fields inherited from class de.schlichtherle.truezip.fs.archive.zip.JarDriver
JAR_CHARSET
 
Fields inherited from class de.schlichtherle.truezip.fs.archive.FsArchiveDriver
NO_INPUT_OPTION, NO_OUTPUT_OPTION
 
Constructor Summary
SafeZipRaesDriver(IOPoolProvider ioPoolProvider, KeyManagerProvider keyManagerProvider)
           
 
Method Summary
 long getAuthenticationTrigger()
          Constructs a new abstract ZIP.RAES driver which uses the given byte size to trigger verification of the Message Authentication Code (MAC).
protected  ZipInputShop newZipInputShop(FsModel model, ReadOnlyFile rof)
           If the net file length of the archive is larger than the authentication trigger, then a CheckedZipInputShop for CRC-32 authentication is returned, otherwise a plain ZipInputShop which doesn't do any authentication.
 
Methods inherited from class de.schlichtherle.truezip.fs.archive.zip.raes.ZipRaesDriver
getKeyManager, getKeyProviderSyncStrategy, getRaesParameters, newController, newEntry, newInputShop, newOutputShop, toMountPointResource
 
Methods inherited from class de.schlichtherle.truezip.fs.archive.zip.JarDriver
newEntry, newEntry
 
Methods inherited from class de.schlichtherle.truezip.fs.archive.zip.ZipDriver
getLevel, getMethod, getOutputSocket, getPool, getPostambled, getPreambled, newZipOutputShop
 
Methods inherited from class de.schlichtherle.truezip.fs.archive.FsCharsetArchiveDriver
assertEncodable, getCharset, toString, toZipOrTarEntryName
 
Methods inherited from class de.schlichtherle.truezip.fs.archive.FsArchiveDriver
getClosedIcon, getInputSocket, getOpenIcon, isFederated, newEntry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AUTHENTICATION_TRIGGER

private static final long AUTHENTICATION_TRIGGER
The default trigger for authentication in bytes (524288L). Input archive files smaller than or equal to this size get verified using the RAES Message Authentication Code (MAC) before they are accessed.

See Also:
Constant Field Values
Constructor Detail

SafeZipRaesDriver

public SafeZipRaesDriver(IOPoolProvider ioPoolProvider,
                         KeyManagerProvider keyManagerProvider)
Method Detail

getAuthenticationTrigger

public final long getAuthenticationTrigger()
Description copied from class: ZipRaesDriver
Constructs a new abstract ZIP.RAES driver which uses the given byte size to trigger verification of the Message Authentication Code (MAC). Note that the given parameter only affects the authentication of the cipher text in input archives - the cipher key and file length are always authenticated with RAES. Returns the value of the property authenticationTrigger. If the size of an input file is smaller than or equal to this value, the Message Authentication Code (MAC) for the entire cipher text is computed and verified in order to authenticate the file. Otherwise, only the cipher key and the file length get authenticated.

Consequently, if the value of this property is set to a negative value, the cipher text gets never verified, and if set to Long.MAX_VALUE, the cipher text gets always authenticated.

Specified by:
getAuthenticationTrigger in class ZipRaesDriver
Returns:
The value of the property authenticationTrigger.

newZipInputShop

protected final ZipInputShop newZipInputShop(FsModel model,
                                             ReadOnlyFile rof)
                                      throws IOException

If the net file length of the archive is larger than the authentication trigger, then a CheckedZipInputShop for CRC-32 authentication is returned, otherwise a plain ZipInputShop which doesn't do any authentication.

This complements the behaviour of the ZipRaesDriver.newInputShop(de.schlichtherle.truezip.fs.FsModel, de.schlichtherle.truezip.socket.InputSocket) method in the super class, which authenticates the cipher text using the MAC iff the gross file length is smaller than or equal to the authentication trigger.

Note that this leaves a small window for gross file lengths of about getAuthenticationTrigger() bytes where the archive is both MAC and CRC-32 authenticated.

Overrides:
newZipInputShop in class ZipDriver
Throws:
IOException

TrueZIP Driver ZIP.RAES (TZP) 7.1

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.