Blackbird
Class CM

java.lang.Object
  extended by Blackbird.CM
All Implemented Interfaces:
EncryptionEntity

public class CM
extends java.lang.Object
implements EncryptionEntity

Blackbird Encryption Project.
Copyright 2008 Blackbird Encryption Project - www.ravenproject.us

    This file is part of Blackbird.

Blackbird is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Blackbird is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Blackbird. If not, see <http://www.gnu.org/licenses/>.
Notes: - By default given the environment the default flctrl value for the encryption and decryption calls is CM_CRYPT_STREAM. - There is a public key private key provision in CodeMeter but is not common. Changes


Nested Class Summary
 class CM.EncryptionControlPanel
          This class is for the entry of an identifier and a related initialization vector that is "attached" to it during the encryption process.
 
Field Summary
static java.lang.String strClassID
           
static int VECTOR_SIZE
           
 
Fields inherited from interface Blackbird.EncryptionEntity
strBBCodeSelect, strFlatSelect, strHTMLSelect
 
Constructor Summary
CM(int x)
           
 
Method Summary
 java.lang.String decrypt(java.lang.String strArgList)
          This is the top level decrypt call in the class, and is called by the applet.
 byte[] encrypt(long lFirmCode, long lProductCode, java.lang.String strPlainText)
          There is not much difference between the encrypt and decrypt calls in the CodeMeter API.
 java.lang.String getClassID()
          Return the class identification string.
 int getIndex()
          All EncryptionEntity instances get an index number assigned to them, and at times that could be called upon, such as during decryption callback events, to make sure the right class in the main entity vector is called.
 java.lang.String getJavaScriptCode()
          This function is where the anonymous JavaScript is generated.
 java.awt.MenuItem[] getMenuItems()
          This returns an array of the menu items that the main applet class will use to build an array of options.
 int getOPCode(java.lang.String s)
          This function returns the Operation Code used to translate menu choice actions into a value that is handed back to the class to determine the next operation.
 void killIVPanel()
          Like the killPanel function, this version is intended for the initialization vector entry panel.
 void killPanel()
          This class will destroy the Encryption Control Panel in CM.
 java.lang.String parseID(java.lang.String arglist)
          parseID is used by those entities that need to single out an Identifier string needed by a using class to find out "who" created the encryption entry.
 void setFrameTarget(int i)
          setFrameTarget is used to set a variable that is concated in the Javascript generation function that is set pertaining to the "position" the applet resides in the DOM.
 void setID(java.lang.String sid)
          Utility function for setting internal User Identifier.
 boolean setPasswordExternally(java.lang.String p)
          CodeMeter uses an initialization vector in symetric CBC encryption.
 boolean setVectorExternally(java.lang.String p)
          CodeMeter encryption uses the license entry as a password, and this function wraps the setPasswordInternally function so there is no naming confusion when this class sets the initialization vector internally from its own control panels.
 void showEncryptionControlPanel(int i, java.awt.Image iconImage, java.lang.Object o)
          This function takes arguments that determine which of several panels to show.
 boolean testRuntime()
          In this class, this is an important function.
 boolean usesPWIVector()
          Some Encryption entities use passwords or initialization vectors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VECTOR_SIZE

public static final int VECTOR_SIZE
See Also:
Constant Field Values

strClassID

public static final java.lang.String strClassID
See Also:
Constant Field Values
Constructor Detail

CM

public CM(int x)
Method Detail

showEncryptionControlPanel

public void showEncryptionControlPanel(int i,
                                       java.awt.Image iconImage,
                                       java.lang.Object o)
This function takes arguments that determine which of several panels to show.

Specified by:
showEncryptionControlPanel in interface EncryptionEntity
Parameters:
i -
iconImage -
o -

killPanel

public void killPanel()
This class will destroy the Encryption Control Panel in CM.

Specified by:
killPanel in interface EncryptionEntity

killIVPanel

public void killIVPanel()
Like the killPanel function, this version is intended for the initialization vector entry panel.


encrypt

public byte[] encrypt(long lFirmCode,
                      long lProductCode,
                      java.lang.String strPlainText)
There is not much difference between the encrypt and decrypt calls in the CodeMeter API. This function uses the API to encrypt data, all of which is done in the CodeMeter device.

Parameters:
lFirmCode -
lProductCode -
strPlainText -
Returns:

testRuntime

public boolean testRuntime()
In this class, this is an important function. CodeMeter Runtime is third party to this applet and must be installed and running on the client machine. It is also shown in tests that if this is not called, then the calls through the eval applied to JavaScript will fail possibly with error 126.

Specified by:
testRuntime in interface EncryptionEntity
Returns:

getJavaScriptCode

public java.lang.String getJavaScriptCode()
This function is where the anonymous JavaScript is generated.

Specified by:
getJavaScriptCode in interface EncryptionEntity

getMenuItems

public java.awt.MenuItem[] getMenuItems()
This returns an array of the menu items that the main applet class will use to build an array of options.

Specified by:
getMenuItems in interface EncryptionEntity
Returns:

getIndex

public int getIndex()
All EncryptionEntity instances get an index number assigned to them, and at times that could be called upon, such as during decryption callback events, to make sure the right class in the main entity vector is called.

Specified by:
getIndex in interface EncryptionEntity
Returns:

getOPCode

public int getOPCode(java.lang.String s)
This function returns the Operation Code used to translate menu choice actions into a value that is handed back to the class to determine the next operation. Often to be used for determining which panel to display.

Specified by:
getOPCode in interface EncryptionEntity
Parameters:
s -
Returns:

setFrameTarget

public void setFrameTarget(int i)
setFrameTarget is used to set a variable that is concated in the Javascript generation function that is set pertaining to the "position" the applet resides in the DOM. What is meant by "Frame Target" is the name of the frame, derived from the frames Name parameter that the applet must invoke Javascript callback results into.

Specified by:
setFrameTarget in interface EncryptionEntity
Parameters:
i -

setVectorExternally

public boolean setVectorExternally(java.lang.String p)
CodeMeter encryption uses the license entry as a password, and this function wraps the setPasswordInternally function so there is no naming confusion when this class sets the initialization vector internally from its own control panels.

Parameters:
p -
Returns:

setPasswordExternally

public boolean setPasswordExternally(java.lang.String p)
CodeMeter uses an initialization vector in symetric CBC encryption. In this case, it's not really a password but this function serves the purpose of building the vector.

Specified by:
setPasswordExternally in interface EncryptionEntity
Parameters:
p -
Returns:

decrypt

public java.lang.String decrypt(java.lang.String strArgList)
This is the top level decrypt call in the class, and is called by the applet. That call in the applet is actually (as seen in the JavaScript) comes from this class itself when the applet applies an Eval call to the JavaScript code. The initialization vector

Specified by:
decrypt in interface EncryptionEntity
Parameters:
strArgList -
Returns:

getClassID

public java.lang.String getClassID()
Return the class identification string.

Specified by:
getClassID in interface EncryptionEntity
Returns:

usesPWIVector

public boolean usesPWIVector()
Some Encryption entities use passwords or initialization vectors. Using programs may need to know that in some cases.

Specified by:
usesPWIVector in interface EncryptionEntity
Returns:

parseID

public java.lang.String parseID(java.lang.String arglist)
parseID is used by those entities that need to single out an Identifier string needed by a using class to find out "who" created the encryption entry. This is not needed by those classes that need not single out an encryption entry for a particuler initialization vector or password. Different classes that use this might have this Identifier is different parts of comma-delimited listing.

Specified by:
parseID in interface EncryptionEntity
Parameters:
arglist -
Returns:

setID

public void setID(java.lang.String sid)
Utility function for setting internal User Identifier.

Specified by:
setID in interface EncryptionEntity
Parameters:
StrID -