cookie CmCalculateSignature

Description

CmCalculateSignature() calculates a signature using the ECDSA algorithm of the given digest directly via a CmContainer entry.

tmr_02

Triple Mode Redundancy-related information (TMR)

 

  • C, C++
  • C#
  • Python
>

Syntax

int CMAPIENTRY CmCalculateSignature(HCMSysEntry hcmse, CMAUTHENTICATE *pcmAuth, CMBYTE *pbSignature, CMUINT cbSignature);

The digest is available as mabDigest of the structure hmtoggle_plus1 CMAUTHENTICATE.

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

pcmAuth contains all information needed for the authentication process (see structure CMAUTHENTICATE.

pbSignature contains the buffer for the signature.

cbSignature contains the length of the buffer of pbSignature. The length has to be CM_PUBLIC_KEY_LEN which is 64.

Return

True (1), if the signature was calculated successful. If an error occurs, 0 is returned and an error code is set.

Notes

•The hash value used for the signature must always be set into pcmAuth->mabDigest.

•The value pcmAuth->mflCtrl has to be a combination of signature method and key source. The values are or'ed together.

•Signature method is one of CM_AUTH_DIRECT, CM_AUTH_EXTENDED, CM_AUTH_EXTENDED2 or CM_AUTH_SERIAL.

•Key source is one of CM_AUTH_HIDDENDATA, CM_AUTH_SECRETDATA, CM_AUTH_SERIALKEY, CM_AUTH_BOXKEY or CM_AUTH_FIRMKEY.

•In the case of Hidden Data or Secret Data, the extended type must be set as pcmAuth->mulKeyExtType. Otherwise this value should be 0.

•CM_AUTH_DIRECT: All other values are ignored and should be set to 0.

•CM_AUTH_EXTENDED(2): pcmAuth->mulEncryptionCodeOptions has to have the same value as for CmValidateSignature. pcmAuth->mulFeatureCode can be set to a specific value. The value will be integrated into the signature but the signature will only be calculated, if the requested Feature Code conforms with the current Feature Map. The signature incorporates the serial number of the signing CodeMeter and the Firm Code / Product Code values used for CmAccess / CmAccess2. These values have to be remembered to correctly verify the signature later using CmValidateSignature.
The flag has been introduced with CodeMeter Version 5.10. Please note that using CM_AUTH_EXTENDED2 requires at least hardware version 2.03.

•CM_AUTH_SERIAL: pcmAuth->mulEncryptionCodeOptions has to have the same value as for CmValidateSignature. All other values should be set to 0. The signature incorporates the serial number of the signing CodeMeter and the Firm Code / Product Code values used for CmAccess / CmAccess2. These values have to be remembered to correctly verify the signature later using CmValidateSignature.

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

Syntax

public bool CmCalculateSignature(HCMSysEntry hcmse, CmAuthenticate Auth, out byte[] Signature)

The digest is available as Digest of the class hmtoggle_plus1 CmAuthenticate.

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

Auth contains all information needed for the authentication process (see class CmAuthenticate).

Signature receives the calculated signature.

Return

true, if the signature was calculated successful. If an error occurs, false is returned and an error code is set.

Notes

•The hash value used for the signature must always be set into Auth->Digest.

•The value Auth->Option has to be a combination of signature method and key source. The values are or'ed together.

•Signature method is one of Direct, Extended, Extended, Extended2 or Serial.

•Key source is one of HiddenData, SecretData, SerialKey, Pisk, BoxKey or FirmKey.

•In the case of Hidden Data or Secret Data, the extended type must be set as Auth->KeyExtType. Otherwise this value should be 0.

•Direct: All other values are ignored and should be set to 0.

•Extended, Extended2: Auth->EncryptionCodeOptions has to have the same value as for CmValidateSignature. Auth->FeatureCode can be set to a specific value. The value will be integrated into the signature but the signature will only be calculated, if the requested Feature Code conforms with the current Feature Map. The signature incorporates the serial number of the signing CodeMeter and the Firm Code / Product Code values used for CmAccess / CmAccess2. These values have to be remembered to correctly verify the signature later using CmValidateSignature.
Extended2 has been introduced with CodeMeter Version 5.10. Please note that using Extended2 requires at least hardware version 2.03.

•Serial: Auth->EncryptionCodeOptions has to have the same value as for CmValidateSignature. All other values should be set to 0. The signature incorporates the serial number of the signing CodeMeter and the Firm Code / Product Code values used for CmAccess / CmAccess2. These values have to be remembered to correctly verify the signature later using CmValidateSignature.

 

Syntax

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

The digest is available as mabDigest of the class hmtoggle_plus1 cmapi.CMAUTHENTICATE.

handle is the handle opened with CmAccess2 (can be a Box Access or an Entry Access).

pcmAuth contains all information needed for the authentication process (see class cmapi.CMAUTHENTICATE.

 

Return

The buffer for the signature if the signature was calculated successful. If an error occurs, a CodeMeterApiFailedException is thrown and an error code is set.

Notes

•The hash value used for the signature must always be set into pcmAuth->mabDigest.

•The value pcmAuth->mflCtrl has to be a combination of signature method and key source. The values are or'ed together.

•Signature method is one of cmapi.CM_AUTH_DIRECT, cmapi.CM_AUTH_EXTENDED, cmapi.CM_AUTH_EXTENDED2 or cmapi.CM_AUTH_SERIAL.

•Key source is one of cmapi.CM_AUTH_HIDDENDATA, cmapi.CM_AUTH_SECRETDATA, cmapi.CM_AUTH_SERIALKEY, cmapi.CM_AUTH_BOXKEY or cmapi.CM_AUTH_FIRMKEY.

•In the case of Hidden Data or Secret Data, the extended type must be set as pcmAuth->mulKeyExtType. Otherwise this value should be 0.

•cmapi.CM_AUTH_DIRECT: All other values are ignored and should be set to 0.

•cmapi.CM_AUTH_EXTENDED(2): pcmAuth->mulEncryptionCodeOptions has to have the same value as for CmValidateSignature. pcmAuth->mulFeatureCode can be set to a specific value. The value will be integrated into the signature but the signature will only be calculated, if the requested Feature Code conforms with the current Feature Map. The signature incorporates the serial number of the signing CodeMeter and the Firm Code / Product Code values used for CmAccess / CmAccess2. These values have to be remembered to correctly verify the signature later using CmValidateSignature.
The flag has been introduced with CodeMeter Version 5.10. Please note that using CM_AUTH_EXTENDED2 requires at least hardware version 2.03.

•cmapi.CM_AUTH_SERIAL: pcmAuth->mulEncryptionCodeOptions has to have the same value as for CmValidateSignature. All other values should be set to 0. The signature incorporates the serial number of the signing CodeMeter and the Firm Code / Product Code values used for CmAccess / CmAccess2. These values have to be remembered to correctly verify the signature later using CmValidateSignature.

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