com.jp.protection.priv
Class LicenseWriter

java.lang.Object
  extended by com.jp.protection.priv.LicenseWriter
Direct Known Subclasses:
ProductLicenseWriter

public class LicenseWriter
extends java.lang.Object

This class is intended to encode and write licenses to the file or output stream


Field Summary
protected  byte[] fEncryptKeyBytes
           
protected  SecurityProvider fSecurityProvider
           
protected  boolean fSkipEncryption
           
protected  boolean fVerbose
           
 
Constructor Summary
LicenseWriter()
          Creates a new instance of the LicenseWriter
 
Method Summary
static void checkLicense(boolean aForceLicenseRead)
           
static LicenseWriter createLicenseWriter()
          Creates a new instance of the LicenseWriter
 byte[] getEncryptKeyBytes()
          Returns bytes array that specifies key used to encrypt the license.
 byte[] getPublicKeyBytes()
          Deprecated. use getEncryptKeyBytes() instead
 boolean isSkipEncryption()
          Checks whether license encryption should be skipped.
 boolean isVerbose()
          Checks whether writer runs in verbose mode.
static void release()
          Releases all the static resources acquired by License Writer's
static void reset()
           
 void setEncryptKeyBytes(byte[] aEncryptKeyBytes)
          Specifies bytes array that represents key used to encrypt the license.
 void setPublicKeyBytes(byte[] aPublicKeyBytes)
          Deprecated. use setEncryptKeyBytes(...) instead
 void setSkipEncryption(boolean aSkipEncryption)
          Specifies that license encryption should be skipped.
 void setVerbose(boolean aVerbose)
          Specifies that writer should run in verbose mode.
 void writeLicense(License aLicense, java.io.File aFile)
          Encodes and writes license to the specified file
 void writeLicense(License aLicense, java.io.OutputStream anOutputStream)
          Encodes and writes license to the specified stream
 
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

fEncryptKeyBytes

protected byte[] fEncryptKeyBytes

fSecurityProvider

protected SecurityProvider fSecurityProvider
Constructor Detail

LicenseWriter

public LicenseWriter()
Creates a new instance of the LicenseWriter

Method Detail

createLicenseWriter

public static LicenseWriter createLicenseWriter()
Creates a new instance of the LicenseWriter

Returns:
a new instance of the LicenseWriter

getEncryptKeyBytes

public byte[] getEncryptKeyBytes()
Returns bytes array that specifies key used to encrypt the license.

Returns:
key bytes

setEncryptKeyBytes

public void setEncryptKeyBytes(byte[] aEncryptKeyBytes)
Specifies bytes array that represents key used to encrypt the license.

Parameters:
aEncryptKeyBytes - key bytes

getPublicKeyBytes

public byte[] getPublicKeyBytes()
Deprecated. use getEncryptKeyBytes() instead

Returns bytes array that specifies public key used to encode the license.

Returns:
public key bytes

setPublicKeyBytes

public void setPublicKeyBytes(byte[] aPublicKeyBytes)
Deprecated. use setEncryptKeyBytes(...) instead

Specifies bytes array that represents public key used to encode the license.

Parameters:
aPublicKeyBytes - public key bytes

isSkipEncryption

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

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

setSkipEncryption

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

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

isVerbose

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

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

setVerbose

public void setVerbose(boolean aVerbose)
Specifies that writer should run in verbose mode. If writer 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 writer should run in verbose mode, false otherwise.

writeLicense

public void writeLicense(License aLicense,
                         java.io.OutputStream anOutputStream)
                  throws java.io.IOException
Encodes and writes license to the specified stream

Parameters:
aLicense - license to encode and write
anOutputStream - stream to write license to
Throws:
java.io.IOException - in case of writing error

writeLicense

public void writeLicense(License aLicense,
                         java.io.File aFile)
                  throws java.io.IOException
Encodes and writes license to the specified file

Parameters:
aLicense - license to encode and write
aFile - file to write license to
Throws:
java.io.IOException - in case of writing error

reset

public static void reset()

release

public static void release()
Releases all the static resources acquired by License Writer's


checkLicense

public static void checkLicense(boolean aForceLicenseRead)