com.jp.protection.pub.pro
Class IntegrityHostPro

java.lang.Object
  extended by com.jp.protection.pub.IntegrityHost
      extended by com.jp.protection.pub.pro.IntegrityHostPro
Direct Known Subclasses:
CRCHostPro, DigestBuilder.IntegrityHostExt

public class IntegrityHostPro
extends IntegrityHost


Nested Class Summary
static class IntegrityHostPro.Config
           
 
Nested classes/interfaces inherited from class com.jp.protection.pub.IntegrityHost
IntegrityHost.CRC32Digest, IntegrityHost.Digest, IntegrityHost.MessageDigest
 
Field Summary
protected  java.lang.String[] fFiles
           
 
Fields inherited from class com.jp.protection.pub.IntegrityHost
ALGORITHM_CRC32, ALGORITHM_DEFAULT, ALGORITHM_MD5, ALGORITHM_SHA_1, fAlgorithm, fCheckDigest, fCRC, fDigest, fDigestBytes, fDigestEntries, fVerbose, WEB_INF
 
Constructor Summary
IntegrityHostPro()
          Creates a new instance of the IntegrityHost
IntegrityHostPro(java.lang.String[] aDigestEntries, byte[] aCheckDigest)
          Creates a new instance of the IntegrityHost
IntegrityHostPro(java.lang.String[] aDigestEntries, java.lang.String[] aFiles, byte[] aCheckDigest)
          Creates a new instance of the IntegrityHost
 
Method Summary
protected  void calculateDigest(java.io.File[] aFiles)
           
protected  void calculateDigest(java.io.File[] aFiles, boolean isReset)
           
 boolean check()
          Main method that do all the work of checking that files are still unchanged against supplied check sum.
 boolean check(java.io.File[] aFiles, byte[] aCheckDigest)
          Check that passed files are not changed.
 boolean check(IntegrityHostPro.Config aConfig)
          Check that classes, resources and files passed as aConfig argument are not changed.
 boolean check(IntegrityHostProConfigReader aReader, java.lang.Class aBaseClass, java.lang.String aResourceName)
          Check that classes, resources and files for configuration loaded from the application resource are not changed.
 boolean check(IntegrityHostProConfigReader aReader, java.io.File aFile)
          Check that classes, resources and files for configuration loaded from a file are not changed.
 boolean check(IntegrityHostProConfigReader aReader, java.io.File aJarFile, java.lang.String anEntryName)
          Check that classes, resources and files for configuration loaded from an archive are not changed.
 boolean check(IntegrityHostProConfigReader aReader, java.lang.String aResourceName)
          Check that classes, resources and files for configuration loaded from the application resource are not changed.
static boolean checkStatic(IntegrityHostPro.Config aConfig)
          Check that classes, resources and files passed as aConfig argument are not changed.
static boolean checkStatic(IntegrityHostProConfigReader aReader, java.lang.Class aBaseClass, java.lang.String aResourceName)
          Check that classes, resources and files for configuration loaded from the application resource are not changed.
static boolean checkStatic(IntegrityHostProConfigReader aReader, java.io.File aFile)
          Check that classes, resources and files for configuration loaded from a file are not changed.
static boolean checkStatic(IntegrityHostProConfigReader aReader, java.io.File aJarFile, java.lang.String anEntryName)
          Check that classes, resources and files for configuration loaded from an archive are not changed.
static boolean checkStatic(IntegrityHostProConfigReader aReader, java.lang.String aResourceName)
          Check that classes, resources and files for configuration loaded from the application resource are not changed.
static boolean checkStatic(java.lang.String[] aDigestEntries, java.lang.String[] aFiles, byte[] aCheckDigest, int anAlgorithm)
          Check that passed classes, resources and files are not changed.
 java.lang.String[] getFiles()
          Returns files to check
 void setFiles(java.lang.String[] aFiles)
          Specifies files to check
protected static java.io.File[] toFiles(java.lang.String[] aFiles)
           
protected  void updateDigest(java.io.File[] aFiles)
           
 
Methods inherited from class com.jp.protection.pub.IntegrityHost
calculate, calculateDigest, calculateDigest, check, check, checkStatic, checkStatic, checkStatic, error, error, getAlgorithm, getAlgorithmStr, getCheckDigest, getCRC, getCRCEntries, getDigest, getDigestEntries, getEntryStream, isVerbose, resetDigest, setAlgorithm, setCheckDigest, setCRC, setCRCEntries, setDigestEntries, setVerbose, toResourceName, updateDigest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fFiles

protected java.lang.String[] fFiles
Constructor Detail

IntegrityHostPro

public IntegrityHostPro(java.lang.String[] aDigestEntries,
                        byte[] aCheckDigest)
Creates a new instance of the IntegrityHost

Parameters:
aDigestEntries - list of classes or resources to check
aCheckDigest - pre-calculated bytes array to check

IntegrityHostPro

public IntegrityHostPro(java.lang.String[] aDigestEntries,
                        java.lang.String[] aFiles,
                        byte[] aCheckDigest)
Creates a new instance of the IntegrityHost

Parameters:
aDigestEntries - list of classes or resources to check
aFiles - list of files to check
aCheckDigest - pre-calculated bytes array to check

IntegrityHostPro

public IntegrityHostPro()
Creates a new instance of the IntegrityHost

Method Detail

getFiles

public java.lang.String[] getFiles()
Returns files to check

Returns:
files to check

setFiles

public void setFiles(java.lang.String[] aFiles)
Specifies files to check

Parameters:
aFiles - files to check

toFiles

protected static java.io.File[] toFiles(java.lang.String[] aFiles)

check

public boolean check()
Description copied from class: IntegrityHost
Main method that do all the work of checking that files are still unchanged against supplied check sum.

Overrides:
check in class IntegrityHost
Returns:
true if files are still unchanged; false otherwise

checkStatic

public static boolean checkStatic(java.lang.String[] aDigestEntries,
                                  java.lang.String[] aFiles,
                                  byte[] aCheckDigest,
                                  int anAlgorithm)
Check that passed classes, resources and files are not changed.

Parameters:
aDigestEntries - list of classes and resources to check
aFiles - list of files to check
aCheckDigest - pre-calculated bytes array to check
aAlgorithm - algorithm should be used to calculate digest
Returns:
true if files are not changed; false otherwise

checkStatic

public static boolean checkStatic(IntegrityHostProConfigReader aReader,
                                  java.io.File aFile)
Check that classes, resources and files for configuration loaded from a file are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aFile - file to load integrity host configuration from
Returns:
true if things are not changed; false otherwise

checkStatic

public static boolean checkStatic(IntegrityHostProConfigReader aReader,
                                  java.io.File aJarFile,
                                  java.lang.String anEntryName)
Check that classes, resources and files for configuration loaded from an archive are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aJarFile - archive to integrity host configuration from
anEntryName - entry name of integrity host configuration within specified archive
Returns:
true if things are not changed; false otherwise

checkStatic

public static boolean checkStatic(IntegrityHostProConfigReader aReader,
                                  java.lang.Class aBaseClass,
                                  java.lang.String aResourceName)
Check that classes, resources and files for configuration loaded from the application resource are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aBaseClass - base class to load integrity host configuration
aResourceName - resource name of integrity host configuration
Returns:
true if things are not changed; false otherwise

checkStatic

public static boolean checkStatic(IntegrityHostProConfigReader aReader,
                                  java.lang.String aResourceName)
Check that classes, resources and files for configuration loaded from the application resource are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aResourceName - resource name of integrity host configuration
Returns:
true if things are not changed; false otherwise

check

public boolean check(IntegrityHostProConfigReader aReader,
                     java.io.File aJarFile,
                     java.lang.String anEntryName)
Check that classes, resources and files for configuration loaded from an archive are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aJarFile - archive to integrity host configuration from
anEntryName - entry name of integrity host configuration within specified archive
Returns:
true if things are not changed; false otherwise

check

public boolean check(IntegrityHostProConfigReader aReader,
                     java.lang.String aResourceName)
Check that classes, resources and files for configuration loaded from the application resource are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aResourceName - resource name of integrity host configuration
Returns:
true if things are not changed; false otherwise

check

public boolean check(IntegrityHostProConfigReader aReader,
                     java.lang.Class aBaseClass,
                     java.lang.String aResourceName)
Check that classes, resources and files for configuration loaded from the application resource are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aBaseClass - base class to load integrity host configuration
aResourceName - resource name of integrity host configuration
Returns:
true if things are not changed; false otherwise

check

public boolean check(IntegrityHostProConfigReader aReader,
                     java.io.File aFile)
Check that classes, resources and files for configuration loaded from a file are not changed.

Parameters:
aReader - a reader to load integrity host configuration
aFile - file to load integrity host configuration from
Returns:
true if things are not changed; false otherwise

checkStatic

public static boolean checkStatic(IntegrityHostPro.Config aConfig)
Check that classes, resources and files passed as aConfig argument are not changed.

Parameters:
aConfig - integrity host configuration
Returns:
true if things are not changed; false otherwise

check

public boolean check(IntegrityHostPro.Config aConfig)
Check that classes, resources and files passed as aConfig argument are not changed.

Parameters:
aConfig - integrity host configuration
Returns:
true if things are not changed; false otherwise

check

public boolean check(java.io.File[] aFiles,
                     byte[] aCheckDigest)
Check that passed files are not changed.

Parameters:
aFiles - list of files to check
aCheckDigest - pre-calculated bytes array to check
Returns:
true if files are not changed; false otherwise

calculateDigest

protected void calculateDigest(java.io.File[] aFiles)

calculateDigest

protected void calculateDigest(java.io.File[] aFiles,
                               boolean isReset)

updateDigest

protected void updateDigest(java.io.File[] aFiles)