TrueZIP Driver ZIP.RAES (TZP) 7.1

de.schlichtherle.truezip.crypto.raes
Class Type0RaesReadOnlyFile

java.lang.Object
  extended by de.schlichtherle.truezip.rof.AbstractReadOnlyFile
      extended by de.schlichtherle.truezip.rof.DecoratingReadOnlyFile
          extended by de.schlichtherle.truezip.crypto.CipherReadOnlyFile
              extended by de.schlichtherle.truezip.crypto.raes.RaesReadOnlyFile
                  extended by de.schlichtherle.truezip.crypto.raes.Type0RaesReadOnlyFile
All Implemented Interfaces:
ReadOnlyFile, Closeable

@NotThreadSafe
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
 class Type0RaesReadOnlyFile
extends RaesReadOnlyFile

Reads a type 0 RAES file.

Author:
Christian Schlichtherle

Field Summary
private  byte[] footer
          The footer of the data envelope containing the authentication codes.
private  Type0RaesParameters.KeyStrength keyStrength
          The key strength.
private  CipherParameters macParam
          The parameters required to init the Message Authentication Code (MAC).
private static long MIN_KEY_RETRY_DELAY
          The minimum delay between subsequent attempts to authenticate a key in milliseconds.
 
Fields inherited from class de.schlichtherle.truezip.rof.DecoratingReadOnlyFile
delegate
 
Constructor Summary
Type0RaesReadOnlyFile(ReadOnlyFile rof, Type0RaesParameters param)
           
 
Method Summary
 void authenticate()
          Authenticates all encrypted data in the read only file.
private static long enforceSuspensionPenalty(long last)
           
 Type0RaesParameters.KeyStrength getKeyStrength()
          Returns the key strength which is actually used to decrypt the data of the RAES file.
 
Methods inherited from class de.schlichtherle.truezip.crypto.raes.RaesReadOnlyFile
getInstance, getInstance, readUByte, readUInt, readUShort
 
Methods inherited from class de.schlichtherle.truezip.crypto.CipherReadOnlyFile
close, computeMac, getFilePointer, init, length, read, read, seek
 
Methods inherited from class de.schlichtherle.truezip.rof.DecoratingReadOnlyFile
toString
 
Methods inherited from class de.schlichtherle.truezip.rof.AbstractReadOnlyFile
read, readFully, readFully
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_KEY_RETRY_DELAY

private static final long MIN_KEY_RETRY_DELAY
The minimum delay between subsequent attempts to authenticate a key in milliseconds.

See Also:
Constant Field Values

keyStrength

private final Type0RaesParameters.KeyStrength keyStrength
The key strength.


macParam

private final CipherParameters macParam
The parameters required to init the Message Authentication Code (MAC).


footer

private final byte[] footer
The footer of the data envelope containing the authentication codes.

Constructor Detail

Type0RaesReadOnlyFile

Type0RaesReadOnlyFile(ReadOnlyFile rof,
                      Type0RaesParameters param)
                throws IOException
Throws:
IOException
Method Detail

enforceSuspensionPenalty

private static long enforceSuspensionPenalty(long last)

getKeyStrength

public Type0RaesParameters.KeyStrength getKeyStrength()
Description copied from class: RaesReadOnlyFile
Returns the key strength which is actually used to decrypt the data of the RAES file.

Specified by:
getKeyStrength in class RaesReadOnlyFile

authenticate

public void authenticate()
                  throws RaesAuthenticationException,
                         IOException
Description copied from class: RaesReadOnlyFile
Authenticates all encrypted data in the read only file. It is safe to call this method multiple times to detect if the file has been tampered with meanwhile.

This is the second, optional step of authentication. The first, mandatory step is to computeMac the cipher key and cipher text length only and has already been successfully completed in the constructor.

Specified by:
authenticate in class RaesReadOnlyFile
Throws:
RaesAuthenticationException - If the computed MAC does not match the MAC declared in the RAES file.
IOException - On any I/O related issue.

TrueZIP Driver ZIP.RAES (TZP) 7.1

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