cookie CmWriteUvd

Description

With CmWriteUvd the content of UvD PIOs can be modified. It is possible to:

•write new data to a UvD PIO of type 'data'.

•erase data stored in a UvD PIO of type 'data'.

•write a new password to a UvD PIO of type 'password'.

•write a new key to a UvD PIO of type 'key'.

•erase a key stored in a UvD PIO of type 'key'.

•let the CmContainer generate a new key stored in a UvD PIO of type 'key'.

•change the subcontent type of a UvD PIO of type 'data' and type 'key'.

It is not possible to partially modify the data. With each write operation the old data will be deleted and overwritten by the new data.

tmr_02

Triple Mode Redundancy-related information (TMR)

  • C, C++
  • C#
  • Python

Syntax

int CMAPIENTRY CmWriteUvd(HCMSysEntry hcmse, CMULONG flCtrl,
         CMUSHORT usIndex, CMUSHORT usLogin,
         CMUSHORT usSubtype, const void *pbData,
         CMULONG cbData);

Parameter

hcmse contains an entry access handle opened by CmAccess2.

flCtrl contains a flag value to specify the write operation:

nav_open CM_UVD_WRITE_DATA writes data to a UvD PIO of type 'data'.

nav_open CM_UVD_WRITE_PASSWORD writes data to a UvD PIO of type 'password'.

nav_open CM_UVD_WRITE_KEY writes data to a UvD PIO of type 'key'.

nav_open CM_UVD_GENERATE_KEY generates a key in the CmContainer.

nav_open CM_UVD_DESTROY_KEY erases a key stored in a UvD PIO of type 'key'.

nav_open CM_UVD_WRITE_SUBTYPE changes the subcontent type of a UvD PIO.
Values included are:

▪        Uvd PIO type 'data': free to choose.

▪        Uvd PIO type 'password': CM_UVD_SCT_PWD_USER.

▪        UVD PIO type 'key':

•CM_UVD_SCT_RSA_4096

•CM_UVD_SCT_RSA_3072

•CM_UVD_SCT_RSA_2048

•CM_UVD_SCT_AES_256

•CM_UVD_SCT_AES_128

nav_open CM_UVD_WRITE_IN_PLACE overwrites the currently stored data in any UvD PIO of type 'data'.
In the case of failure, the old data will be lost. This can be used to reduce the required internal memory of the CmContainer to perform this operation.

usIndex contains the index of the UvD PIO.

usLogin contains a 'login number'.

ulSubtype contains the current or new subtype of the UvD PIO.

pbData contains the buffer containing the data to write. To write a RSA key the structure hmtoggle_plus1 CMPRIVATEKEY. must be used.

cbDest contains the size of the data.

Return

TRUE(1) is returned in the case of success. If an error occurs, 0 is returned.

Error codes may be as follows:

•CMERROR_INVALID_HANDLE, if the used entry access handle is invalid.

•CMERROR_WRONG_HANDLE_TYPE, if the type of the handle is not a entry handle e.g. a subsystem, box or Firm Item handle.

•CMERROR_INVALID_PARAMETER,

oif pbData == NULL and cbData != 0.

oif usSubtype contains a not defined value for the UvD PIOs of type 'key' and 'password'.

•CMERROR_OPTIONUNDEFINED, if the value in flCtrl is invalid.

•CMERROR_INDEXINVALID, if the specified index does not refer to a UvD PIO.

•CMERROR_PRODUCTITEMOPTIONINVALID,

oif the specified index does not refer to the UvD PIO of type 'data'.

oif the PIO status is invalid.

•CMERROR_INVALID_LOGIN, if the specified 'login number' is not in use.

•CMERROR_ACCESS_DENIED,

oif the write operation is password protected and the given 'login number' is not valid.

oif write operations are not permitted at all.

oif modifying the content does not require a password, but usLogin != 0.

•CMERROR_SESSION_EXPIRED, if the session used to create usLogin has expired.

•CMERROR_ENCRYPTIONINVALID, if decrypting the encrypted data returned by the CmContainer fails.

•CMERROR_DATATOOLONG, if the CmContainer does not have enough free memory to store the data.

•CMERROR_WRONG_BOX_VERSION, .if the Firmware version of the CmContainer is too old.

•CMERROR_FUNCTION_NOT_SUPPORTED, if used with CmActLicense Firm Code or CmActLicense Universal Firm Code container.

Notes

Only CmDongle is supported. A Minimum CmDongle Firmware version of 4.40 is required.

•In order to write a RSA key the structure CMPRIVATEKEY must be use as pbData.

•If a RSA key should be generated in the CmContainer, the public exponent must be specified in the CMPRIVATEKEY structure.

•If the UVD PIO is not password protected and writing content is allowed, usLogin must be 0.

•If cbData == 0 is used together with an UvD PIO of type 'data', the content of the PIO will be erased.

•If a UvD PIO of type 'key' should be written, CM_UVD_WRITE_SUBTYPE must always be set.

•CM_UVD_GENERATE_KEY can just be used with UvD PIOs which where randomly generated in the programming step by the CmContainer itself.

•In the case of CM_UVD_DESTROY_KEY pbData can be NULL.

•In the case of an error the old data will be restored. Except CM_UVD_WRITE_IN_PLACE is used. In this case, the old data cannot be restored. CM_UVD_WRITE_IN_PLACE will reduce the required internal memory size of CmContainer to write the data. If CMERROR_DATATOOLONG is returned, it is maybe possible to write the data using CM_UVD_WRITE_IN_PLACE.

 

No method available.

 

Not implemented.