Syntax
int CMAPIENTRY CmEnablingGetChallenge(HCMSysEntry hcmse, CMENABLING_APPCONTEXT *pcmAppContext, CMBYTE *pbChallenge, CMUINT cbChallenge)
Parameter
hcmse contains a handle opened by CmAccess / CmAccess2 (can be Box Access or Entry Access).
pcmappcontext contains all information needed to enable/disable a CmContainer/entry (see the structure
CMENABLING_APPCONTEXT).
Structure CMENABLING_APPCONTEXT
CMENABLING_APPCONTEXT contains basic data of a Enable Block Item (EBI).
Syntax
typedef struct __CMENABLING_APPCONTEXT {
CMULONG mulFirmCode;
CMULONG mulProductCode;
CMBOXINFO mcmBoxInfo;
CMULONG mflCtrl;
CMUSHORT midEnableBlockItem;
CMUSHORT musReserve;
CMULONG mulFirmUpdateCounter;
CMULONG midIdentity;
char mszCompanyName[CM_MAX_COMPANY_LEN];
} CMENABLING_APPCONTEXT;
|
Parameter
mulFirmCode contains the Firm Code containing the EBI.
mulProductCode contains the Product Code containing the EBI.
mcmBoxInfo contains the data of the CmContainer.
mflCtrl specifies the following flags.
CM_AC_VALID specifies that the enabling block item is a valid structure.
CM_AC_DISABLED specifies that the Disabling Flag of the Enabling Block Item is set and the block is permanently disabled.
CM_AC_TEMPENABLED specifies that the Enabling Block Item is temporarily enabled, independently of the static Enabling Status of the EBI. This option is only permitted, if the EBI is owned by the IFI (Implicit Firm Item).
midEnableBlockItem contains the number of the EBI.
musReserve is reserved for future purposes.
mulFirmUpdateCounter contains the Firm Update Counter of the Firm Item containing the EBI.
midIdentity obsolete.
mszCompanyName contains the company owning the Firm Code to enable.
|
pbChallenge contains the buffer for the challenge.
cbChallenge contains the buffer length of pbChallenge.
Return
The length of the returned challenge is returned. If an error occurred, the value 0 is returned and an error code is set. If pbChallenge does not contain enough memory, the amount of required bytes will be returned. In this case, the return value is larger than the cbChallenge parameter and error code CMERROR_BUFFER_OVERFLOW is set.
Notes
The challenge received by the CmContainer is valid for 180 seconds. If the response to this challenge is sent after that period, an error is returned.
Syntax
public bool CmEnablingGetChallenge(HCMSysEntry hcmse, CmEnablingAppContext AppContext, out byte[] Challenge)
|
Parameter
hcmse contains a handle opened by CmAccess / CmAccess2 (can be Box Access or Entry Access).
AppContext contains all information needed to enable/disable a CmContainer/entry (see the class
CmEnablingAppContext).
Class CmEnablingAppContext
CmEnablingAppContext contains basic data of a Enable Block Item (EBI).
Syntax
public class CmEnablingAppContext {
public CmBoxInfo BoxInfo;
public uint FirmCode;
public uint ProductCode;
public CmEnablingAppContext.Option Ctrl;
public enum Option : short
{
Valid = (short) -32768,
Disabled = (short) 1,
TempEnabled = (short) 2,
}
|
public ushort EnableBlockItem;
public ushort Reserve;
public uint FirmUpdateCounter;
public uint Identity;
public string CompanyName;
}
|
Parameter
BoxInfo contains the data of the CmContainer using a BoxInfo class.
Class Cm BoxInfo contains information on a CmContainer.
Syntax
public class CmBoxInfo : ICmGetSet
{
public byte MajorVersion;
public byte MinorVersion;
public ushort BoxMask;
public uint SerialNumber;
public ushort BoxKeyId;
public ushort UserKeyId;
public byte[] BoxPublicKey;
public byte[] SerialPublicKey;
}
|
Parameter
MajorVersion contains the major version of the CmContainer.
MinorVersion contains the minor version of the CmContainer.
BoxMask contains the box mask of the CmContainer.
SerialNumber contains the serial number of the CmContainer.
BoxKeyId contains the ID of the used BoxKey of the CmContainer.
UserKeyId contains the ID of the used UserKey of the CmContainer.
BoxPublicKey contains the public Box Key of the CmContainer.
SerialPublicKey contains the public Serial Key of the CmContainer.
Notes
The length of the BoxPublicKey and SerialPublicKey is 64 byte long. The used public key are currently 224 bits = 28 bytes long. In Elliptic Curve Cryptography the public key is a 2 dimensional point, so the x-value is stored in the first 28 bytes (0..27) and the y-value is store in byte 32..59.
|
FirmCode contains the Firm Code containing the EBI.
ProductCode contains the Product Code containing the EBI.
CmEnablingAppContext.Option specifies the following flags.
Valid specifies that the enabling block item is a valid structure.
Disabled specifies that the Disabling Flag of the Enabling Block Item is set and the block is permanently disabled.
TempEnabled specifies that the Enabling Block Item is temporarily enabled, independently of the static Enabling Status of the EBI. This option is only permitted, if the EBI is owned by the IFI (Implicit Firm Item).
EnableBlockItem contains the number of the EBI.
Reserve is reserved for future purposes.
FirmUpdateCounter contains the Firm Update Counter of the Firm Item containing the EBI.
Identity obsolete.
CompanyName contains the company owning the Firm Code to enable.
|
|
Challenge contains the challenge.
Notes
The challenge received by the CmContainer is valid for 180 seconds. If the response to this challenge is sent after that period, an error is returned.
Not implemented.