cookie CmGetPublicKey

Description

CmGetPublicKey returns a public key from the CmContainer. The CmContainer usually stores private keys only. With this request the CmContainer calculates the corresponding public key.

tmr_02

Triple Mode Redundancy-related information (TMR)

 

  • C, C++
  • C#
  • Python

Syntax

int CMAPIENTRY CmGetPublicKey(HCMSysEntry hcmse, CMAUTHENTICATE *pcmAuth, CMBYTE *pbPubKey, CMUINT cbPubKey);

Parameter

hcmse contains a handle opened by CmAccess / CmAccess2 (can be Box Access or Entry Access).

pcmAuth contains the specification of the desired public key (see structure hmtoggle_plus1 CMAUTHENTICATE).

pbPubKey contains the buffer for the public key.Please note: If you use CmGetPublicKey with the Universal Data (UvD) PIO, then use pbPubKey as the structure hmtoggle_plus1 CMPUBLICKEY.

cbPubKey contains the length of the pbPubKey buffer. Please note: If you use CmGetPublicKey with the Universal Data (UvD) PIO, then set cbPubKey to sizeof(CMPUBLICKEY).

Return

The return value is TRUE, if the public key is returned, FALSE if not.

Notes

The pcmAuth structure has to be almost completely empty. The only value that has to be set is mflCtrl which has to be set to one of the following values: CM_AUTH_HIDDENDATA, CM_AUTH_SECRETDATA, CM_AUTH_SERIALKEY, CM_AUTH_UNIVERSALDATA or CM_AUTH_BOXKEY.

The value CM_AUTH_FIRMKEY is invalid here as this function cannot directly calculate the public key for the Firm Key. To calculate the public key for the Firm Key for Firm Item X calculate the public key for FSB entry 99:x Secret Data 128.

CM_AUTH_PISK (Product Item Secret Key) has been introduced with CodeMeter Version 6.0 (License Transfer).

Syntax

public bool CmGetPublicKey(HCMSysEntry hcmse, CmAuthenticate Auth, out byte[] PubKey)

Parameter

hcmse contains a handle opened by CmAccess / CmAccess2 (can be Box Access or Entry Access).

Auth contains the specification of the desired public key (see class hmtoggle_plus1 CmAuthenticate).

PubKey contains the returned public key.

Return

The return value is true, if the public key is returned, false if not.

Notes

The Auth structure has to be almost completely empty. The only value that has to be set is Option which has to be set to one of the following values: HiddenData, SecretData, SerialKey, Pisk or BoxKey.

The value FirmKey is invalid here as this function cannot directly calculate the public key for the Firm Key. To calculate the public key for the Firm Key for Firm Item X calculate the public key for FSB entry 99:x Secret Data 128.

 

Syntax

import cmapi
 
handle.CmGetPublicKey(pcmAuth: CMAUTHENTICATE) -> bytes
throws CodeMeterApiFailedException()

Parameter

handle is the handle opened by CmAccess / CmAccess2 (can be Box Access or Entry Access).

pcmAuth contains the specification of the desired public key (see class hmtoggle_plus1 cmapi.CMAUTHENTICATE).

pbPubKey contains the buffer for the public key.Please note: If you use CmGetPublicKey with the Universal Data (UvD) PIO, then use pbPubKey as the class hmtoggle_plus1 cmapi.CMPUBLICKEY.

cbPubKey contains the length of the pbPubKey buffer. Please note: If you use CmGetPublicKey with the Universal Data (UvD) PIO, then set cbPubKey to cmapi.CMPUBLICKEY).

Return

The public key is returned, A CodeMeterApiFailedException is thrown if not.

Notes

The pcmAuth structure has to be almost completely empty. The only value that has to be set is mflCtrl which has to be set to one of the following values: cmapi.CM_AUTH_HIDDENDATA, cmapi.CM_AUTH_SECRETDATA, cmapi.CM_AUTH_SERIALKEY, cmapi.CM_AUTH_UNIVERSALDATA or cmapi.CM_AUTH_BOXKEY.

The value cmapi.CM_AUTH_FIRMKEY is invalid here as this function cannot directly calculate the public key for the Firm Key. To calculate the public key for the Firm Key for Firm Item X calculate the public key for FSB entry 99:x Secret Data 128.