CmValidateSignature
Description
CmValidateSignature validates a passed signature using the passed public key and the ECDSA algorithm.
Syntax
int CMAPIENTRY CmValidateSignature(CMAUTHENTICATE *pcmAuth, CMBYTE *pbSignature, CMUINT cbSignature, CMBYTE *pbPubKey, CMUINT cbPubKey);
Parameter
pcmAuth contains the specification of the validation process (see structure
CMAUTHENTICATE).
|
CMAUTHENTICATE contains all information needed for an authentication process. Syntax
Parameter mflCtrl contains one of the following commands:
This commands can be or'ed with one of the following flags:
mulKeyExtType contains the extended type of the Hidden Data or Secret Data PIO, if in mflCtrl CM_AUTH_HIDDENDATA or CM_AUTH_SECRETDATA is specified. Otherwise this member must be set to 0. mulFirmCode contains the Firm Code used for the authentication process. mulProductCode contains the Product Code used for the authentication process. mulEncryptionCodeOptions contains the Encryption Code Options, this are the higher 32 bits of the Encryption Code. This value is only used, if mflCtrl has set the CM_AUTH_EXTENDED,CM_AUTH_EXTENDED2 or CM_AUTH_SERIAL option. Otherwise it must be set to 0. mulFeatureCode contains the used Feature Code, which must match the used Feature Map. This value is only used, if mflCtrl has set the CM_AUTH_EXTENDED, CM_AUTH_EXTENDED2 option. Otherwise it must be set to 0. mcmBoxInfo contains the CmContainer information used for the authentication process. mabDigest contains the 32-byte res. 256-bit digest which is signed.
|
pbSignature contains the buffer for the signature to validate.
cbSignature contains the length of the pbSignature buffer.
pbPubKey contains the buffer for the public key needed for validation.
cbPubKey contains the length of the pbPubKey buffer.
Return
The hash value used for the signature must always be set into pcmAuth->mabDigest. The value pcmAuth->mflCtrl is set to one of the following values: CM_AUTH_DIRECT, CM_AUTH_EXTENDED,CM_AUTH_EXTENDED2, CM_AUTH_SERIAL. Depending on this value the following values must be set accordingly:
•CM_AUTH_DIRECT: All other values are ignored and can be set to 0.
•CM_AUTH_EXTENDED, CM_AUTH_EXTENDED2: pcmAuth->mulEncryptionCodeOptions and pcmAuth->mulFeatureCode have to have the same value as for CmValidateSignature. pcmAuth->mulFirmCode and pcmAuth->mulProductCode have to match the values used for CmAccess2 performed for CmCalculateSignature.
•CM_AUTH_SERIAL: pcmAuth->mulEncryptionCodeOptions has to have the same value as for CmCalculateSignature. pcmAuth->mcmBoxInfo.musBoxMask and pcmAuth->mcmBoxInfo.mulSerialNumber have to be set to identify the signing box. pcmAuth->mulFirmCode and pcmAuth->mulProductCode have to match the values used for CmAccess2 performed for CmValidateSignature.
performed for CmValidateSignature.
•Serial: Auth->EncryptionCodeOptions has to have the same value as for CmCalculateSignature: Auth->BoxInfo.BoxMask and Auth->BoxInfo.SerialNumber have to be set to identify the signing box. Auth->FirmCode and Auth->ProductCode have to match the values used for CmAccess2 performed for CmValidateSignature.