Proposed Additions to Encryption Objects

Required Methods for Each Supported Encryption Algorithm

**unsigned int
GetBlockSize(void)**

- Description: Retrieves the block size used by the encryption algorithm.
- Return: The block size used by the encryption algorithm.

**bool
EncryptBlock(unsigned int vnBlockSize, void * vpBlock)**

- Description: Encrypts the block of data.
- Return: True on success or false on failure.
- unsigned int vnBlockSize: The size of the block to be encrypted (must be a multiple of the block size of the algorithm).
- void * vpBlock: A pointer to the block of data to be encrypted.

**bool
EncryptBlock(unsigned int vnBlockSize, void * vpBlock)**

- Description: Decrypts the block of data.
- Return: True on success or false on failure.
- unsigned int vnBlockSize: The size of the block to be decrypted (must be a multiple of the block size of the algorithm).
- void * vpBlock: A pointer to the block of data to be decrypted.

Required Structures

**EncryptionInfo**

- unsigned int anHeader[2]: An 8 byte header used to ensure that the user actually passed an EncryptionInfo structure.
- unsigned char nVersion: The version of the structure, which would be 1 until the structure is changed (if it ever is).
- unsigned int (*pfunGetBlockSize)(void): A pointer to the GetBlockSize function for the algorithm.
- bool (*pfunEncryptBlock)(unsigned int, void *): A pointer to the EncryptBlock function for the algorithm.
- bool (*pfunDecryptBlock)(unsigned int, void *): A pointer to the DecryptBlock function for the algorithm.

Required Expressions for Each Supported Algorithm

**int GetEncryptionInfo(string
szObjectName [****, optional parameters****])**

- Description: Retrieves a pointer to the EncryptionInfo structure for an algorithm. It may also use additional parameters for storing settinsg to be used during encryption or decryption (e.g. an encryption key). This pointer is then passed to a supporting object which will call the appropriate functions in the EncryptionInfo structure. A supporting object should never store this structure. That is, it should always finish its encrypting or decrypting before returning control back to MMF.
- Return: A pointer to the EncryptionInfo structure for the algorithm.
- string szObjectName: The name of the object as required by all MMF expressions.

About Supporting Objects

If an object would like to make use of an Encryption object, it must create an condition/action/expression using the following guidelines:

- One parameter must take a pointer to the EncryptionInfo structure of the Encryption object.
- The object must first call the GetBlockSize of the method and ensure that the size of the block of data to be encrypted or decrypted is a multiple of that returned value.
- Once the block of data is of an acceptable size, the object may then call the EncryptBlock or DecryptBlock function.
- If the call fails, the object should somehow notify the user (though this is not a requirement).