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 using Elliptic Curve Cryptography (ECC).
Syntax
int CMAPIENTRY CmGetPublicKey(HCMSysEntry hcmse, CMAUTHENTICATE *pcmAuth, CMBYTE *pbPubKey, CMUINT cbPubKey);
Parameter
hcmse contains a handle opened by CmAccess2 ( Entry Access).
pcmAuth contains the specification of the desired public key (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(2) 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(2) 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.
|
pbPubKey contains the buffer for the public key.
cbPubKey contains the length of the pbPubKey buffer.
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.
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).