TrueZIP 6.8.3

de.schlichtherle.io.archive.zip.raes
Class SafeZipRaesDriver

java.lang.Object
  extended by de.schlichtherle.io.archive.spi.AbstractArchiveDriver
      extended by de.schlichtherle.io.archive.zip.ZipDriver
          extended by de.schlichtherle.io.archive.zip.JarDriver
              extended by de.schlichtherle.io.archive.zip.raes.AbstractZipRaesDriver
                  extended by de.schlichtherle.io.archive.zip.raes.SafeZipRaesDriver
All Implemented Interfaces:
ArchiveDriver, Serializable
Direct Known Subclasses:
SafeZip32RaesDriver

public class SafeZipRaesDriver
extends AbstractZipRaesDriver

A safe archive driver which builds RAES encrypted ZIP files. 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!

Instances of this class are immutable.

Since:
TrueZIP 6.0
Author:
Christian Schlichtherle
See Also:
ParanoidZipRaesDriver, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class de.schlichtherle.io.archive.spi.AbstractArchiveDriver
AbstractArchiveDriver.InconsistentCharsetSupportError
 
Field Summary
static long DEFAULT_AUTHENTICATION_TRIGGER
          The default trigger for authentication in bytes (524288L).
private static long serialVersionUID
           
 
Fields inherited from class de.schlichtherle.io.archive.zip.JarDriver
DEFAULT_CHARSET
 
Fields inherited from class de.schlichtherle.io.archive.zip.ZipDriver
DEFAULT_LEVEL
 
Constructor Summary
SafeZipRaesDriver()
          Equivalent to this(null, null, false, false, DEFAULT_LEVEL, DEFAULT_AUTHENTICATION_TRIGGER).
SafeZipRaesDriver(Icon openIcon, Icon closedIcon, boolean preambled, boolean postambled, int level, long authenticationTrigger)
          Constructs a new safe ZIP.RAES driver.
SafeZipRaesDriver(int level)
          Equivalent to this(null, null, false, false, level, DEFAULT_AUTHENTICATION_TRIGGER).
 
Method Summary
protected  ZipInputArchive createZipInputArchive(Archive archive, ReadOnlyFile rof)
           If the net file length of the archive is larger than the authentication trigger, then a CheckedJarInputArchive for CRC-32 authentication is returned, otherwise a plain ZipInputArchive which doesn't do any authentication.
 
Methods inherited from class de.schlichtherle.io.archive.zip.raes.AbstractZipRaesDriver
createArchiveEntry, createInputArchive, createOutputArchive, getAuthenticationTrigger, getRaesParameters
 
Methods inherited from class de.schlichtherle.io.archive.zip.JarDriver
createZipEntry, createZipEntry
 
Methods inherited from class de.schlichtherle.io.archive.zip.ZipDriver
createZip32InputArchive, createZip32OutputArchive, createZipOutputArchive, getLevel, getPostambled, getPreambled
 
Methods inherited from class de.schlichtherle.io.archive.spi.AbstractArchiveDriver
ensureEncodable, getCharset, getClosedIcon, getEncoding, getOpenIcon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.schlichtherle.io.archive.spi.ArchiveDriver
equals, hashCode
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

DEFAULT_AUTHENTICATION_TRIGGER

public static final long DEFAULT_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()
Equivalent to this(null, null, false, false, DEFAULT_LEVEL, DEFAULT_AUTHENTICATION_TRIGGER).


SafeZipRaesDriver

public SafeZipRaesDriver(int level)
Equivalent to this(null, null, false, false, level, DEFAULT_AUTHENTICATION_TRIGGER).


SafeZipRaesDriver

public SafeZipRaesDriver(Icon openIcon,
                         Icon closedIcon,
                         boolean preambled,
                         boolean postambled,
                         int level,
                         long authenticationTrigger)
Constructs a new safe ZIP.RAES driver.

Method Detail

createZipInputArchive

protected ZipInputArchive createZipInputArchive(Archive archive,
                                                ReadOnlyFile rof)
                                         throws IOException

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

This complements the behaviour of the AbstractZipRaesDriver.createInputArchive(de.schlichtherle.io.archive.Archive, de.schlichtherle.io.rof.ReadOnlyFile) 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 AbstractZipRaesDriver.getAuthenticationTrigger() bytes where the archive is both MAC and CRC-32 authenticated.

Overrides:
createZipInputArchive in class JarDriver
Throws:
IOException

TrueZIP 6.8.3

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