de.schlichtherle.io.archive.zip.raes
Class SafeZipRaesDriver
java.lang.Object
de.schlichtherle.io.archive.spi.AbstractArchiveDriver
de.schlichtherle.io.archive.zip.ZipDriver
de.schlichtherle.io.archive.zip.JarDriver
de.schlichtherle.io.archive.zip.raes.AbstractZipRaesDriver
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
|
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). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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.
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
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.