CmEmbedded_4c_transp CmCalculateSignature

Description

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

  • C, C++

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 CmAccess2 (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.

•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 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 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).