CmEnablingWriteApplicationKey
Description
CmEnablingWriteApplicationKey adds/attaches/updates/detaches/deletes the access code to the CmContainer.
|
Triple Mode Redundancy-related information (TMR)
|
Syntax
int CMAPIENTRY CmEnablingWriteApplicationKey(HCMSysEntry hcmse, CMULONG flCtrl, void *pvCtrl, CMUINT cbCtrl)
Parameter
hcmse contains a handle opened by CmAccess / CmAccess2 (can be Box Access or Entry Access).
flCtrl contains one of the following operation commands:
CM_EW_ADD adds a new Enable Block Item to a Firm Item. The input parameters are provided in the
CMENABLING_WRITEADD) structure. The return value of the function is the index of the created Enable Block Item in the Enable Block Table. If no Enable Block Item is created, then 0 is returned and an error code is set.
|
CMENABLING_WRITEADD describes the request sequence of the adding a Enable Block Item. Syntax
Parameter mcbLength contains the size of this structure. musFirmItemReference contains the reference of the Firm Item in which the Enabling Block is added. If this is 0, the IFI (Implicit Firm Item) is used. mcmEnableBlockItem specifies the Enabling Block Item which is added.
|
CM_EW_ATTACH attaches an existing Enable Block Item to a Firm Item or Product Item. The input parameters are provided in a
CMENABLING_WRITEATTACHDETACH structure. The return value of the function is 1 (TRUE), if no error occurred, else 0 (FALSE).
Structure CMENABLING_WRITEATTACHDETACH CMENABLING_WRITEATTACHDETACH describes the request sequence for attaching or detaching a Enable Block Item (EBI). Syntax
Parameter mbEnableBlockIndex contains the index of the Enabling Block Item which is attached. The subsequent bytes are encrypted by AES-CBC or Triple-DES-CBC. They have a fixed length of 32 bytes. musFirmItemReference contains the reference of the Firm Item in which the Enabling Block is attached. If this is 0, the IFI (Implicit Firm Item) is used. musProductItemReference contains the Reference of the Product Item in which the Enabling Block is attached. If the Enabling Block should be attached to the Firm Item, this member must be set to 0. If musFirmItemReference specifies 0, the Product Item may be individually addressed by setting Common Product Item (CPI) or User product item (UPI). mulFirmUpdateCounter contains the current value of the Firm Update Counter of the Firm Item which owns the Enabling Block. mcmEnableLookupEntry contains the Enabling Lookup Entry which defines the attachment. If the mbEnableLevel member is set to CM_ELUE_DETACH, the Enabling Lookup Entry is deleted. mabTrailingValidationBlock contains the TVB (Trailing Validation Block), which contains the current hash sequence (16 bytes) to validate that the sequence is correctly encrypted. Notes All parameters set by the user to this structure must be set in Little Endian format! Normally this must be noticed on Big Endian CPU's like the Apple Macintosh. On PC's (x86) the parameters (16 & 32 Bit) are stored in Little Endian so that the user has nothing to mentioned (Little/Big Endian).
|
CM_EW_UPDATE updates the contents of an existing Enable Block Item. The input parameters are provided in a byte array (pointer to unsigned char). The return value is 1 (TRUE), if if no error occurred, else 0 (FALSE).
CM_EW_DETACH detaches an existing Enable Block Item from a Firm Item or Product Item. The input parameters are provided in a CMENABLING_WRITE_ATTACH structure. The return value is 1 (TRUE), if no error occurred, else 0 (FALSE).
CM_EW_DELETE deletes an existing Enable Block Item in a Firm Item. The input parameters are provided in a
CMENABLING_WRITEDELETE structure. The return value is 1 (TRUE), if no error occurred, else 0 (FALSE).
Structure CMENABLING_WRITEDELETE CMENABLING_WRITEDELETE describes the request sequence for deleting a Enable Block Item (EBI). command. Syntax
Parameter musFirmItemReference contains the reference of the Firm Item which defines the Enabling Block. If this is 0, the IFI (Implicit Firm Item) is used. mbEnableBlockIndex contains the index of the Enabling Block which is deleted. This must be a value between 0 and 30. mabTrailingValidationBlock contains the Trailing Validation Block (TVB), which checks whether the delete operation is valid. This is an AES encryption of the SHA-256 hash of the preceding bytes.
|
pvCtrl contains the key information to add/attach/update/detach/delete in the CmContainer. The required structures can be obtained from the flag descriptions above. Parts of the input structures are encrypted.
cbCtrl contains the length of data stored in pvCtrl.
Return
The return values depend on the set flag in flCtrl. Please refer to the individual flag descriptions.
Syntax
public int CmEnablingWriteApplicationKey (HCMSysEntry hcmse, CmEnablingWriteApplicationKeyOption Option, object Ctrl)
} |
Parameter
hcmse contains a handle opened by CmAccess / CmAccess2 (can be Box Access or Entry Access).
CmEnablingWriteApplicationKeyOption.Option contains one of the following operation commands:
Add adds a new Enable Block Item to a Firm Item. The input parameters are provided in the
CmEnablingWriteAdd class. The return value of the function is the index of the created Enable Block Item in the Enable Block Table. If no Enable Block Item is created, then 0 is returned and an error code is set.
|
CmEnablingWriteAdd describes the request sequence of the adding a Enable Block Item. Syntax
Parameter EnableBlockItem specifies the Enabling Block Item which is added.
Length contains the size of this structure. FirmItemReference contains the reference of the Firm Item in which the Enabling Block is added. If this is 0, the IFI (Implicit Firm Item) is used.
|
ATTACH attaches an existing Enable Block Item to a Firm Item or Product Item. The input parameters are provided in a
CmEnablingWriteAttachDetach class. The return value of the function is 1 (TRUE), if no error occurred, else 0 (FALSE).
Class CmEnablingWriteAttachDetach CmEnablingWriteAttachDetach describes the request sequence for attaching or detaching a Enable Block Item (EBI). Syntax
Parameter EnableLookupEntry contains the Enabling Lookup Entry which defines the attachment. EnableBlockIndex contains the index of the Enabling Block Item which is attached. The subsequent bytes are encrypted by AES-CBC or Triple-DES-CBC. They have a fixed length of 32 bytes. FirmItemReference contains the reference of the Firm Item in which the Enabling Block is attached. If this is 0, the IFI (Implicit Firm Item) is used. ProductItemReference contains the Reference of the Product Item in which the Enabling Block is attached. If the Enabling Block should be attached to the Firm Item, this member must be set to 0. If musFirmItemReference specifies 0, the Product Item may be individually addressed by setting Common Product Item (CPI) or User product item (UPI). FirmUpdateCounter contains the current value of the Firm Update Counter of the Firm Item which owns the Enabling Block. TrailingValidationBlock contains the TVB (Trailing Validation Block), which contains the current hash sequence (16 bytes) to validate that the sequence is correctly encrypted. Notes All parameters set by the user to this structure must be set in Little Endian format! Normally this must be noticed on Big Endian CPU's like the Apple Macintosh. On PC's (x86) the parameters (16 & 32 Bit) are stored in Little Endian so that the user has nothing to mentioned (Little/Big Endian).
|
Update updates the contents of an existing Enable Block Item. The input parameters are provided in a byte array (pointer to unsigned char). The return value is 1 (true), if no error occurred, else 0 (false).
Detach detaches an existing Enable Block Item from a Firm Item or Product Item. The input parameters are provided in a CmEnablingWriteAttachDetach structure. The return value is 1 (true), if no error occurred, else 0 (false).
Delete deletes an existing Enable Block Item in a Firm Item. The input parameters are provided in a
CmEnablingWriteDelete class. The return value is 1 (true), if no error occurred, else 0 (false).
|
CmEnablingWriteDelete describes the request sequence for deleting a Enable Block Item (EBI). command. Syntax
Parameter FirmItemReference contains the reference of the Firm Item which defines the Enabling Block. If this is 0, the IFI (Implicit Firm Item) is used. EnableBlockIndex contains the index of the Enabling Block which is deleted. This must be a value between 0 and 30. TrailingValidationBlock contains the Trailing Validation Block (TVB), which checks whether the delete operation is valid. This is an AES encryption of the SHA-256 hash of the preceding bytes.
|
CmdMask allows to use a bit mask for Enable Block Item operations.
Ctrl contains the key information to add/attach/update/detach/delete in the CmContainer. The required structures can be obtained from the flag descriptions above. Parts of the input structures are encrypted.
Return
The return values depend on the set flag in CmEnablingWriteApplicationKeyOption.Option. Please refer to the individual flag descriptions.
Not implemented.