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.
|
Triple Mode Redundancy-related information (TMR)
|
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
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.Please note: If you use CmGetPublicKey with the Universal Data (UvD) PIO, then use pbPubKey as the structure
CMPUBLICKEY.
|
CMPUBLICKEY stores all needed parameters needed for specifying a public key. Syntax
Parameter musKeyType contains specification on key types. KEY_LEN:
RSA:
|
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
CmAuthenticate).
|
CmAuthenticate contains all information needed for an authentication process. Syntax
Parameter BoxInfo contains the CmContainer information used for the authentication process. CmAuthenticate.Option contains one of the following commands:
KeyExtType contains the extended type of the Hidden Data or Secret Data PIO, if in Option HiddenData or SecretData is specified. Otherwise this member must be set to 0. FirmCode contains the Firm Code used for the authentication process. ProductCode contains the Product Code used for the authentication process. EncryptionCodeOptions contains the Encryption Code Options, this are the higher 32 bits of the Encryption Code. This value is only used, if Option has been set the Extended(2) or Serial option. Otherwise it must be set to 0. FeatureCode contains the used Feature Code, which must match the used Feature Map. This value is only used, if Option has been set the Extended(2) option. Otherwise it must be set to 0. Digest contains the 32-byte res. 256-bit digest which is signed.
|
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
cmapi.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 cmapi.CM_AUTH_HIDDENDATA or cmapi.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 cmapi.CM_AUTH_EXTENDED(2) or cmapi.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 cmapi.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.Please note: If you use CmGetPublicKey with the Universal Data (UvD) PIO, then use pbPubKey as the class
cmapi.CMPUBLICKEY.
|
CMPUBLICKEY stores all needed parameters needed for specifying a public key. Syntax
Parameter musKeyType contains specification on key types. KEY_LEN:
RSA:
|
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.