|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jp.protection.pub.IntegrityHost
public class IntegrityHost
Provides methods to ensure that certain files are still unchanged using previously calculated digest
| Nested Class Summary | |
|---|---|
protected static class |
IntegrityHost.CRC32Digest
|
protected static interface |
IntegrityHost.Digest
|
protected static class |
IntegrityHost.MessageDigest
|
| Field Summary | |
|---|---|
static int |
ALGORITHM_CRC32
Deprecated. since 2.0 use SHA1 or MD5 instead |
static int |
ALGORITHM_DEFAULT
Specifies default digest algorithm constant |
static int |
ALGORITHM_MD5
Specifies MD5 digest algorithm constant |
static int |
ALGORITHM_SHA_1
Specifies SHA1 digest algorithm constant |
protected int |
fAlgorithm
|
protected byte[] |
fCheckDigest
|
protected long |
fCRC
|
protected IntegrityHost.Digest |
fDigest
|
protected byte[] |
fDigestBytes
|
protected java.lang.String[] |
fDigestEntries
|
protected boolean |
fVerbose
|
protected static java.lang.String |
WEB_INF
|
| Constructor Summary | |
|---|---|
IntegrityHost()
Creates a new instance of the IntegrityHost |
|
IntegrityHost(java.lang.String[] aDigestEntries,
byte[] aCheckDigest)
Creates a new instance of the IntegrityHost |
|
IntegrityHost(java.lang.String[] aDigestEntries,
long aCRC)
Deprecated. use IntegrityHost(String[] aDigestEntries, byte[]
aCheckBytes) instead |
|
| Method Summary | |
|---|---|
protected long |
calculate(byte[] aBytes)
|
protected static byte[] |
calculateDigest(long aCRC)
|
protected void |
calculateDigest(java.lang.String[] aDigestEntries)
|
boolean |
check()
Main method that do all the work of checking that files are still unchanged against supplied check sum. |
protected boolean |
check(java.lang.String[] aDigestEntries,
byte[] aCheckDigest)
|
protected boolean |
check(java.lang.String[] aDigestEntries,
long anCRC)
|
static boolean |
checkStatic(java.lang.String[] aDigestEntries,
byte[] aCheckDigest)
Static main method that do all the work of checking that files are still unchanged against supplied check sum. |
static boolean |
checkStatic(java.lang.String[] aDigestEntries,
byte[] aCheckDigest,
int anAlgorithm)
Static main method that do all the work of checking that files are still unchanged against supplied check sum. |
static boolean |
checkStatic(java.lang.String[] aDigestEntries,
long anCRC)
Deprecated. since 2.0 |
protected void |
error(java.lang.String aMessage)
|
protected void |
error(java.lang.Throwable ex)
|
int |
getAlgorithm()
Returns algorithm used to calculate check sum. |
static java.lang.String |
getAlgorithmStr(int anAlgorithm)
Returns string representation of the algorithm used to calculate check sum. |
byte[] |
getCheckDigest()
Returns digest to check |
long |
getCRC()
Deprecated. since 2.0 use getCheckDigest() instead |
java.lang.String[] |
getCRCEntries()
Deprecated. since 3.0 use getDigestEntries() instead |
byte[] |
getDigest()
Returns digest value |
java.lang.String[] |
getDigestEntries()
Returns entries to check |
protected java.io.InputStream |
getEntryStream(java.lang.String crcEntry)
|
boolean |
isVerbose()
Checks whether Integrity Host runs in verbose mode. |
void |
resetDigest()
Resets digest |
void |
setAlgorithm(int aAlgorithm)
Specifies algorithm used to calculate check sum as one of ALGORITHM_ constants. |
void |
setCheckDigest(byte[] aCheckDigest)
Specifies digest to check |
void |
setCRC(long aCRC)
Deprecated. since 2.0 use setCheckDigest() instead |
void |
setCRCEntries(java.lang.String[] aDigestEntries)
Deprecated. since 3.0 use setDigestEntries() instead |
void |
setDigestEntries(java.lang.String[] aDigestEntries)
Specifies entries to check |
void |
setVerbose(boolean aVerbose)
Specifies that Integrity Host should run in verbose mode. |
static java.lang.String |
toResourceName(java.lang.Class aClass)
Makes resource name based on passed class name e.g. |
void |
updateDigest(byte[] aBytes)
Updates digest with the array of bytes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String[] fDigestEntries
protected long fCRC
public static final int ALGORITHM_CRC32
public static final int ALGORITHM_SHA_1
public static final int ALGORITHM_MD5
public static final int ALGORITHM_DEFAULT
protected IntegrityHost.Digest fDigest
protected int fAlgorithm
protected byte[] fDigestBytes
protected static final java.lang.String WEB_INF
protected boolean fVerbose
protected byte[] fCheckDigest
| Constructor Detail |
|---|
public IntegrityHost(java.lang.String[] aDigestEntries,
long aCRC)
IntegrityHost(String[] aDigestEntries, byte[]
aCheckBytes) instead
IntegrityHost
aDigestEntries - classes and resources to checkaCRC - pre-calculated CRC to check
public IntegrityHost(java.lang.String[] aDigestEntries,
byte[] aCheckDigest)
IntegrityHost
aDigestEntries - list of files to checkaCheckDigest - pre-calculated bytes array to checkpublic IntegrityHost()
IntegrityHost
| Method Detail |
|---|
public int getAlgorithm()
public static java.lang.String getAlgorithmStr(int anAlgorithm)
anAlgorithm - algorithm
public void setAlgorithm(int aAlgorithm)
ALGORITHM_ constants.
aAlgorithm - algorithm should be used to calculate digestpublic long getCRC()
getCheckDigest() instead
public void setCRC(long aCRC)
setCheckDigest() instead
aCRC - CRC valuepublic java.lang.String[] getCRCEntries()
getDigestEntries() instead
public java.lang.String[] getDigestEntries()
public void setCRCEntries(java.lang.String[] aDigestEntries)
setDigestEntries() instead
aDigestEntries - entries to checkpublic void setDigestEntries(java.lang.String[] aDigestEntries)
aDigestEntries - entries to checkpublic boolean check()
true if files are still unchanged; false
otherwise
public static boolean checkStatic(java.lang.String[] aDigestEntries,
long anCRC)
IntegrityHost instance for the users' convenience
aDigestEntries - files to checkanCRC - check sum to check
true if files are still unchanged; false otherwise
public static boolean checkStatic(java.lang.String[] aDigestEntries,
byte[] aCheckDigest,
int anAlgorithm)
IntegrityHost instance for the users' convenience
aDigestEntries - classes and resources to checkaCheckDigest - check digest to checkanAlgorithm - algorithm should be used to check
true if files are still unchanged; false otherwise
public static boolean checkStatic(java.lang.String[] aDigestEntries,
byte[] aCheckDigest)
IntegrityHost instance for the users' convenience.
The ALGORITHM_DEFAULT will be used to check.
aDigestEntries - classes and resourcesaCheckDigest - check digest to check
true if files are still unchanged; false otherwise
protected boolean check(java.lang.String[] aDigestEntries,
long anCRC)
protected boolean check(java.lang.String[] aDigestEntries,
byte[] aCheckDigest)
public void resetDigest()
public void updateDigest(byte[] aBytes)
aBytes - array of bytes to update digestpublic byte[] getDigest()
protected void calculateDigest(java.lang.String[] aDigestEntries)
protected long calculate(byte[] aBytes)
protected java.io.InputStream getEntryStream(java.lang.String crcEntry)
public static java.lang.String toResourceName(java.lang.Class aClass)
com/jp/samples/protection/DemoCalcProtectionSupport$1.class
aClass - class to get resource name for
public boolean isVerbose()
true if Integrity Host runs in verbose mode, false
otherwise.public void setVerbose(boolean aVerbose)
std err. Otherwise
there is no output in order to prevent the code flow analysis.
aVerbose - true if Integrity Host should run in verbose mode,
false otherwise.protected void error(java.lang.String aMessage)
protected void error(java.lang.Throwable ex)
public byte[] getCheckDigest()
public void setCheckDigest(byte[] aCheckDigest)
aCheckDigest - digest to checkprotected static byte[] calculateDigest(long aCRC)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||