com.jp.protection.pub.launch
Class ProtectionLauncherConfigReader

java.lang.Object
  extended by com.jp.protection.pub.launch.ProtectionLauncherConfigReader

public class ProtectionLauncherConfigReader
extends java.lang.Object

This class allows reading of launcher configuration

Since:
3.0

Field Summary
protected  byte[] fDecryptKeyBytes
           
protected  java.lang.String fSecurityAlgorithm
           
protected  SecurityProvider fSecurityProvider
           
protected  boolean fSkipEncryption
           
protected  boolean fVerbose
           
 
Constructor Summary
ProtectionLauncherConfigReader()
          Creates a new instance of reader
ProtectionLauncherConfigReader(java.lang.String aSecurityAlgorithm, byte[] aDecryptKeyBytes)
          Creates a new instance of reader and initializes it with security algorithm and decrypt key bytes.
 
Method Summary
protected  void error(java.lang.Throwable aThrowable)
           
 byte[] getDecryptKeyBytes()
          Returns bytes array that specifies key used to decrypt the ProtectionLauncherConfig.
 java.lang.String getSecurityAlgorithm()
          Returns security algorithm to be used to decode ProtectionLauncherConfig's
protected  SecurityProvider getSecurityProvider()
           
 boolean isSkipEncryption()
          Checks whether ProtectionLauncherConfig encryption should be skipped.
 boolean isVerbose()
          Checks whether reader runs in verbose mode.
protected  ProtectionLauncherConfig read(byte[] aConfigBytes)
           
 ProtectionLauncherConfig read(java.lang.Class aBaseClass, java.lang.String aResourceName)
          Reads and decodes ProtectionLauncherConfig from the specified resource
 ProtectionLauncherConfig read(java.io.File aFile)
          Reads and decodes ProtectionLauncherConfig from the specified file
 ProtectionLauncherConfig read(java.io.File aJarFile, java.lang.String anEntryName)
          Reads and decodes ProtectionLauncherConfig from an entry of the specified JAR file
 ProtectionLauncherConfig read(java.io.InputStream anInputStream)
          Reads and decodes ProtectionLauncherConfig from the specified stream
 void setDecryptKeyBytes(byte[] aDecryptKeyBytes)
          Specifies bytes array that represents key used to decrypt the ProtectionLauncherConfig.
 void setDecryptKeyBytes(java.lang.String aDecryptKeyBytes)
          Specifies bytes array used to restore the key required to decrypt the the ProtectionLauncherConfig.
 void setSecurityAlgorithm(java.lang.String aSecurityAlgorithm)
          Specifies security algorithm to be used to decode ProtectionLauncherConfig's
 void setSkipEncryption(boolean aSkipEncryption)
          Specifies that ProtectionLauncherConfig encryption should be skipped.
 void setVerbose(boolean aVerbose)
          Specifies that reader should run in verbose mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fVerbose

protected boolean fVerbose

fSkipEncryption

protected boolean fSkipEncryption

fSecurityAlgorithm

protected java.lang.String fSecurityAlgorithm

fDecryptKeyBytes

protected byte[] fDecryptKeyBytes

fSecurityProvider

protected SecurityProvider fSecurityProvider
Constructor Detail

ProtectionLauncherConfigReader

public ProtectionLauncherConfigReader()
Creates a new instance of reader


ProtectionLauncherConfigReader

public ProtectionLauncherConfigReader(java.lang.String aSecurityAlgorithm,
                                      byte[] aDecryptKeyBytes)
Creates a new instance of reader and initializes it with security algorithm and decrypt key bytes.

Parameters:
aSecurityAlgorithm - security algorithm
aDecryptKeyBytes - byte[] decrypt key bytes
Method Detail

getSecurityProvider

protected SecurityProvider getSecurityProvider()

getSecurityAlgorithm

public java.lang.String getSecurityAlgorithm()
Returns security algorithm to be used to decode ProtectionLauncherConfig's

Returns:
security algorithm

setSecurityAlgorithm

public void setSecurityAlgorithm(java.lang.String aSecurityAlgorithm)
Specifies security algorithm to be used to decode ProtectionLauncherConfig's

Parameters:
aSecurityAlgorithm - resurity algorithm

getDecryptKeyBytes

public byte[] getDecryptKeyBytes()
Returns bytes array that specifies key used to decrypt the ProtectionLauncherConfig.

Returns:
key bytes

setDecryptKeyBytes

public void setDecryptKeyBytes(byte[] aDecryptKeyBytes)
Specifies bytes array that represents key used to decrypt the ProtectionLauncherConfig.

Parameters:
aDecryptKeyBytes - key bytes

setDecryptKeyBytes

public void setDecryptKeyBytes(java.lang.String aDecryptKeyBytes)
Specifies bytes array used to restore the key required to decrypt the the ProtectionLauncherConfig.

Parameters:
aDecryptKeyBytes - decrypt key bytes as String e.g. "1, 23, 45, 23, -1"

isSkipEncryption

public boolean isSkipEncryption()
Checks whether ProtectionLauncherConfig encryption should be skipped.

Returns:
true ProtectionLauncherConfig encryption should be skipped, false otherwise.

setSkipEncryption

public void setSkipEncryption(boolean aSkipEncryption)
Specifies that ProtectionLauncherConfig encryption should be skipped. Note: skipping can be useful for debugging purposes only.

Parameters:
aSkipEncryption - true if ProtectionLauncherConfig encryption should be skipped, false otherwise.

isVerbose

public boolean isVerbose()
Checks whether reader runs in verbose mode.

Returns:
true if reader runs in verbose mode, false otherwise.

setVerbose

public void setVerbose(boolean aVerbose)
Specifies that reader should run in verbose mode. If reader run in verbose mode all thrown exceptions and stack traces will be printed out to the stderr. Otherwise there is no output generated in order to prevent the "code flow" analysis.

Parameters:
aVerbose - true if reader should run in verbose mode, false otherwise.

error

protected void error(java.lang.Throwable aThrowable)

read

public ProtectionLauncherConfig read(java.io.InputStream anInputStream)
                              throws java.io.IOException
Reads and decodes ProtectionLauncherConfig from the specified stream

Parameters:
anInputStream - stream to read ProtectionLauncherConfig from
Returns:
ProtectionLauncherConfig has been read
Throws:
java.io.IOException - in case of reading error

read

public ProtectionLauncherConfig read(java.lang.Class aBaseClass,
                                     java.lang.String aResourceName)
                              throws java.io.IOException
Reads and decodes ProtectionLauncherConfig from the specified resource

Parameters:
aBaseClass - base class for resource loading via call of aBaseCLass.getResourceAsStream(...)
aResourceName - resource to read ProtectionLauncherConfig from
Returns:
ProtectionLauncherConfig has been read
Throws:
java.io.IOException - in case of reading error

read

protected ProtectionLauncherConfig read(byte[] aConfigBytes)
                                 throws java.io.IOException
Throws:
java.io.IOException

read

public ProtectionLauncherConfig read(java.io.File aFile)
                              throws java.io.IOException
Reads and decodes ProtectionLauncherConfig from the specified file

Parameters:
aFile - file to read ProtectionLauncherConfig from
Returns:
ProtectionLauncherConfig has been read
Throws:
java.io.IOException - in case of reading error

read

public ProtectionLauncherConfig read(java.io.File aJarFile,
                                     java.lang.String anEntryName)
                              throws java.io.IOException
Reads and decodes ProtectionLauncherConfig from an entry of the specified JAR file

Parameters:
aJarFile - JAR file to read ProtectionLauncherConfig from
anEntryName - name of entry to read ProtectionLauncherConfig from
Returns:
ProtectionLauncherConfig has been read
Throws:
java.io.IOException - in case of reading error