globalplatform
Macros | Functions
globalplatform.c File Reference

This implements all Open- and GlobalPlatform functions. More...

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "globalplatform/globalplatform.h"
#include <string.h>
#include <errno.h>
#include "globalplatform/debug.h"
#include "unzip/unzip.h"
#include "unzip/zip.h"
#include "util.h"
#include "crypto.h"
#include "scp.h"
#include "loadfile.h"
Include dependency graph for globalplatform.c:

Macros

#define MAX_APDU_DATA_SIZE(secInfo)   (get_max_apdu_data_size(secInfo))
 
#define GP211_SCP11_DEFAULT_CA_KLOC_KEY_IDENTIFIER   0x10
 
#define MAX_PATH   257
 
#define CARD_DATA_APPLICATION_TAG_8   0x68
 
#define CARD_DATA_APPLICATION_TAG_7   0x67
 
#define CARD_DATA_APPLICATION_TAG_6   0x66
 
#define CARD_DATA_APPLICATION_TAG_5   0x65
 
#define CARD_DATA_APPLICATION_TAG_4   0x64
 
#define CARD_DATA_APPLICATION_TAG_3   0x63
 
#define CARD_DATA_APPLICATION_TAG_0   0x60
 
#define OID_TAG   0x06
 
#define CHECK_SW_9000(recvBuffer, recvBufferLength, status)
 

Functions

OPGP_NO_API OPGP_ERROR_STATUS calculate_install_token (BYTE P1, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, PDWORD installTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 
OPGP_NO_API OPGP_ERROR_STATUS put_asymmetric_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase, BYTE keyType, BOOL includeEccDomainParameters)
 
OPGP_NO_API OPGP_ERROR_STATUS put_delegated_management_receipt_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, BYTE receiptKey[32], DWORD keyLength, BYTE receiptKeyType)
 
OPGP_NO_API OPGP_ERROR_STATUS put_3des_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, BYTE _3DESKey[16])
 
OPGP_NO_API OPGP_ERROR_STATUS put_secure_channel_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, PBYTE newBaseKey, PBYTE newS_ENC, PBYTE newS_MAC, PBYTE newDEK, DWORD keyLength, BYTE keyType)
 
OPGP_NO_API OPGP_ERROR_STATUS delete_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex)
 
OPGP_NO_API OPGP_ERROR_STATUS delete_application (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, OPGP_AID *AIDs, DWORD AIDsLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, PBYTE deleteToken, DWORD deleteTokenLength, DWORD mode)
 
OPGP_NO_API OPGP_ERROR_STATUS get_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE identifier[2], PBYTE recvBuffer, PDWORD recvBufferLength)
 
OPGP_NO_API OPGP_ERROR_STATUS get_data_with_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE identifier[2], PBYTE dataObject, DWORD dataObjectLength, PBYTE recvBuffer, PDWORD recvBufferLength)
 
OPGP_NO_API OPGP_ERROR_STATUS put_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE identifier[2], PBYTE dataObject, DWORD dataObjectLength)
 
OPGP_NO_API OPGP_ERROR_STATUS get_key_information_templates (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keyInformationTemplate, GP211_KEY_INFORMATION *keyInformation, PDWORD keyInformationLength)
 
OPGP_NO_API OPGP_ERROR_STATUS get_extended_card_resources_information (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, OPGP_EXTENDED_CARD_RESOURCE_INFORMATION *extendedCardResourceInformation)
 
OPGP_NO_API OPGP_ERROR_STATUS set_status (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE statusType, PBYTE AID, DWORD AIDLength, BYTE lifeCycleState)
 
OPGP_NO_API OPGP_ERROR_STATUS load (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, GP211_DAP_BLOCK *loadFileDataBlockSignature, DWORD loadFileDataBlockSignatureLength, OPGP_STRING executableLoadFileName, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, OPGP_PROGRESS_CALLBACK *callback)
 
OPGP_NO_API OPGP_ERROR_STATUS install_for_install_and_make_selectable (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, DWORD installTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 
OPGP_NO_API OPGP_ERROR_STATUS install_for_load (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, PBYTE loadToken, DWORD loadTokenLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit)
 
OPGP_NO_API OPGP_ERROR_STATUS install_for_install (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, DWORD installTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 
OPGP_NO_API OPGP_ERROR_STATUS install_for_make_selectable (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, PBYTE installToken, DWORD installTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 
OPGP_NO_API OPGP_ERROR_STATUS pin_change (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE tryLimit, PBYTE newPIN, DWORD newPINLength)
 
OPGP_NO_API OPGP_ERROR_STATUS mutual_authentication (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, PBYTE baseKeyOrStaticOcePrivateKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK, DWORD keyLength, BYTE keySetVersion, BYTE keyIndex, BYTE secureChannelProtocol, BYTE secureChannelProtocolImpl, BYTE securityLevel, BYTE derivationMethod, PBYTE certOceEcka, DWORD certOceEckaLength, PBYTE sdPublicKeyOverride, DWORD sdPublicKeyOverrideLength, OPGP_STRING sdPublicKeyFileName, GP211_SECURITY_INFO *secInfo)
 
OPGP_NO_API OPGP_ERROR_STATUS get_install_data (BYTE P1, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installData, PDWORD installDataLength)
 
OPGP_NO_API OPGP_ERROR_STATUS load_from_buffer (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, GP211_DAP_BLOCK *loadFileDataBlockSignature, DWORD loadFileDataBlockSignatureLength, PBYTE loadFileBuf, DWORD loadFileBufSize, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, OPGP_PROGRESS_CALLBACK *callback)
 
OPGP_NO_API OPGP_ERROR_STATUS VISA2_derive_keys_get_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE AID, DWORD AIDLength, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 
OPGP_NO_API OPGP_ERROR_STATUS VISA1_derive_keys_get_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 
OPGP_NO_API OPGP_ERROR_STATUS EMV_CPS11_derive_keys_get_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 
OPGP_NO_API void mapOP201ToGP211SecurityInfo (OP201_SECURITY_INFO op201secInfo, GP211_SECURITY_INFO *gp211secInfo)
 
OPGP_NO_API void mapGP211ToOP201SecurityInfo (GP211_SECURITY_INFO gp211secInfo, OP201_SECURITY_INFO *op201secInfo)
 
OPGP_NO_API void mapOP201ToGP211DAPBlock (OP201_DAP_BLOCK op201dapBlock, GP211_DAP_BLOCK *gp211dapBlock)
 
OPGP_NO_API void mapOP201ToGP211ReceiptData (OP201_RECEIPT_DATA op201receiptData, GP211_RECEIPT_DATA *gp211receiptData)
 
OPGP_NO_API void mapGP211ToOP201ReceiptData (GP211_RECEIPT_DATA gp211receiptData, OP201_RECEIPT_DATA *op201receiptData)
 
OPGP_NO_API void mapGP211ToOP201KeyInformation (GP211_KEY_INFORMATION gp211keyInformation, OP201_KEY_INFORMATION *op201keyInformation)
 
OPGP_NO_API void mapGP211ToOP201ApplicationData (GP211_APPLICATION_DATA gp211applData, OP201_APPLICATION_DATA *op201applData)
 
OPGP_NO_API OPGP_ERROR_STATUS readDAPBlock (PBYTE buf, PDWORD bufLength, OP201_DAP_BLOCK dapBlock)
 
OPGP_NO_API OPGP_ERROR_STATUS parse_application_data (PBYTE data, DWORD dataLength, BYTE cardElement, BYTE format, GP211_APPLICATION_DATA *applData, PDWORD dataRead)
 
OPGP_NO_API OPGP_ERROR_STATUS parse_executable_load_file_data (PBYTE data, DWORD dataLength, BYTE format, GP211_EXECUTABLE_MODULES_DATA *modulesData, PDWORD dataRead)
 
OPGP_NO_API DWORD fillReceipt (PBYTE buf, DWORD bufLength, GP211_RECEIPT_DATA *receiptData)
 
OPGP_NO_API OPGP_ERROR_STATUS parse_receipt_from_response (PBYTE recvBuffer, DWORD recvBufferLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 
OPGP_ERROR_STATUS GP211_send_APDU (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE capdu, DWORD capduLength, PBYTE rapdu, PDWORD rapduLength)
 Sends an application protocol data unit. More...
 
OPGP_ERROR_STATUS OPGP_select_application (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE AID, DWORD AIDLength)
 GlobalPlatform2.1.1: Selects an application on a card by AID and resets secure channel state. More...
 
OPGP_ERROR_STATUS GP211_put_asymmetric_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase, BYTE keyType)
 GlobalPlatform2.3.1: replaces a single public asymmetric key in a key set or adds a new public asymmetric key. More...
 
OPGP_ERROR_STATUS GP211_put_rsa_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.1.1: replaces a single public RSA key in a key set or adds a new public RSA key. More...
 
OPGP_ERROR_STATUS GP211_put_ecc_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: replaces a single public ECC key in a key set or adds a new public ECC key. More...
 
OPGP_ERROR_STATUS GP211_put_ecc_key_with_curve_parameter_reference (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: replaces or adds a public ECC key using a curve parameter reference. More...
 
OPGP_ERROR_STATUS GP211_put_ecc_private_key_with_curve_parameter_reference (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, BYTE privateKey[32], DWORD privateKeyLength)
 GlobalPlatform2.3.1: replaces or adds a raw private ECC key using a curve parameter reference. More...
 
OPGP_ERROR_STATUS GP211_put_3des_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, BYTE _3DESKey[16])
 GlobalPlatform2.1.1: replaces a single 3DES key in a key set or adds a new 3DES key. More...
 
OPGP_ERROR_STATUS GP211_put_aes_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, BYTE aesKey[32], DWORD keyLength)
 GlobalPlatform2.1.1: replaces a single AES key in a key set or adds a new AES key. More...
 
OPGP_ERROR_STATUS GP211_put_symmetric_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, BYTE key[32], DWORD keyLength, BYTE keyType)
 GlobalPlatform2.1.1: replaces a single symmetric key in a key set or adds a new key. More...
 
OPGP_ERROR_STATUS GP211_put_secure_channel_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, PBYTE newBaseKey, PBYTE newS_ENC, PBYTE newS_MAC, PBYTE newDEK, DWORD keyLength, BYTE keyType)
 GlobalPlatform2.1.1: replaces or adds a secure channel key set consisting of S-ENC, S-MAC and DEK. More...
 
OPGP_ERROR_STATUS GP211_put_delegated_management_token_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase, BYTE tokenKeyType)
 GlobalPlatform2.1.1: Adds a token verification key set for Delegated Management. More...
 
OPGP_ERROR_STATUS GP211_put_dap_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase, BYTE keyType, BYTE key[32], DWORD keyLength)
 GlobalPlatform2.3.1: Adds a DAP verification key set (asymmetric or symmetric). More...
 
OPGP_ERROR_STATUS GP211_put_delegated_management_receipt_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, BYTE receiptKey[32], DWORD keyLength, BYTE receiptKeyType)
 GlobalPlatform2.1.1: Adds a receipt generation key set for Delegated Management. More...
 
OPGP_ERROR_STATUS GP211_delete_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex)
 GlobalPlatform2.1.1: deletes a key or multiple keys. More...
 
OPGP_ERROR_STATUS GP211_delete_application (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, OPGP_AID *AIDs, DWORD AIDsLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, PBYTE deleteToken, DWORD deleteTokenLength)
 GlobalPlatform2.1.1: Deletes a Executable Load File or an application. More...
 
OPGP_ERROR_STATUS GP211_put_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE identifier[2], PBYTE dataObject, DWORD dataObjectLength)
 GlobalPlatform2.1.1: Put card data. More...
 
OPGP_ERROR_STATUS GP211_get_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE identifier[2], PBYTE recvBuffer, PDWORD recvBufferLength)
 GlobalPlatform2.1.1: Retrieve card data. More...
 
OPGP_ERROR_STATUS GP211_get_ecka_certificate (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keyVersionNumber, BYTE keyIdentifier, PBYTE recvBuffer, PDWORD recvBufferLength)
 SCP11: Retrieves the ECKA certificate store (GET DATA with tag BF21). More...
 
OPGP_ERROR_STATUS GP211_ca_kloc_kid_kvn (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE caKlocIdentifier, DWORD caKlocIdentifierLength, BYTE *keyIdentifier, BYTE *keyVersionNumber)
 SCP11: Resolves KID/KVN from a CA-KLOC Identifier (GET DATA with tag 0083). More...
 
OPGP_ERROR_STATUS GP211_get_supported_ca_identifiers (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BOOL returnCaKlccIdentifiers, PBYTE recvBuffer, PDWORD recvBufferLength)
 SCP11: Retrieves supported CA identifiers (GET DATA with tag FF33 or FF34). More...
 
OPGP_ERROR_STATUS GP211_perform_security_operation (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE caKlocKeyVersionNumber, BYTE caKlocKeyIdentifier, PBYTE certificateData, DWORD certificateDataLength, BOOL moreCertificatesExpected)
 SCP11: Submits CERT.OCE.ECKA (PERFORM SECURITY OPERATION, INS 2A). More...
 
OPGP_ERROR_STATUS GP211_perform_security_operation_certificate_chain (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE caKlocKeyVersionNumber, BYTE caKlocKeyIdentifier, PBYTE certificateChainData, DWORD certificateChainDataLength)
 SCP11: Submits a certificate chain ending in CERT.OCE.ECKA with PERFORM SECURITY OPERATION. More...
 
OPGP_ERROR_STATUS GP211_get_diversification_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE recvBuffer, PDWORD recvBufferLength)
 GlobalPlatform2.1.1: Retrieve diversification data (tag 0xCF). More...
 
OPGP_ERROR_STATUS OPGP_parse_cplc (const BYTE *data, DWORD dataLength, OPGP_CPLC *cplc)
 Parses the CPLC data response. More...
 
OPGP_ERROR_STATUS OPGP_get_cplc (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, OPGP_CPLC *cplc)
 Reads and parses the CPLC data. More...
 
OPGP_ERROR_STATUS GP211_begin_R_MAC (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE securityLevel, PBYTE data, DWORD dataLength)
 Initiates a R-MAC session. More...
 
OPGP_ERROR_STATUS GP211_end_R_MAC (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE secureChannelProtocol)
 Terminates a R-MAC session. More...
 
OPGP_ERROR_STATUS GP211_get_data_iso7816_4 (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, BYTE identifier[2], PBYTE recvBuffer, PDWORD recvBufferLength)
 Retrieve card data according ISO/IEC 7816-4 command not within a secure channel. More...
 
OPGP_ERROR_STATUS GP211_get_card_recognition_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, GP211_CARD_RECOGNITION_DATA *cardData)
 GlobalPlatform2.1.1: Return the card recognition data. More...
 
OPGP_ERROR_STATUS GP211_parse_card_recognition_data (const BYTE *data, DWORD dataLength, GP211_CARD_RECOGNITION_DATA *cardData)
 Parses the card recognition data response. More...
 
OPGP_ERROR_STATUS GP211_parse_scp11_certificate (PBYTE certificateData, DWORD certificateDataLength, GP211_SCP11_CERTIFICATE *certificate)
 SCP11: Parses a certificate encoded according to table 6-12. More...
 
OPGP_ERROR_STATUS GP211_parse_certificate_store (const BYTE *certificateStoreData, DWORD certificateStoreDataLength, PBYTE parsedCertificateStore, PDWORD parsedCertificateStoreLength)
 SCP11: Parses a BF21 certificate store. For legacy GP certificates (tag '7F21') the output contains a contiguous array of GP211_SCP11_CERTIFICATE structures. For X.509 DER certificates (tag '30') the output contains PEM encoded CERTIFICATE blocks.
 
OPGP_ERROR_STATUS GP211_build_scp11_certificate (GP211_SCP11_CERTIFICATE *certificate, OPGP_STRING subjectPublicKeyFileName, char *subjectPublicKeyPassPhrase, OPGP_STRING signingPrivateKeyFileName, char *signingPrivateKeyPassPhrase, PBYTE certificateData, PDWORD certificateDataLength)
 SCP11: Builds and signs a certificate encoded according to table 6-12. More...
 
OPGP_ERROR_STATUS OPGP_build_bcd_encoding (const char *numericString, PBYTE bcdData, PDWORD bcdDataLength)
 BCD encodes a numeric string. More...
 
OPGP_ERROR_STATUS GP211_build_card_recognition_data (const GP211_CARD_RECOGNITION_DATA *cardData, PBYTE data, PDWORD dataLength)
 Builds the card recognition data response. More...
 
OPGP_ERROR_STATUS GP211_get_card_capability_information (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, GP211_CARD_CAPABILITY_INFORMATION *cardCapabilityInfo)
 GlobalPlatform2.3.1: Return the card capability information. More...
 
OPGP_ERROR_STATUS GP211_parse_card_capability_information (const BYTE *data, DWORD dataLength, GP211_CARD_CAPABILITY_INFORMATION *cardCapabilityInfo)
 Parses the card capability information response. More...
 
OPGP_ERROR_STATUS GP211_get_secure_channel_protocol_details (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE *secureChannelProtocol, BYTE *secureChannelProtocolImpl)
 GlobalPlatform2.1.1: This returns the Secure Channel Protocol and the Secure Channel Protocol implementation. More...
 
OPGP_ERROR_STATUS GP211_get_key_information_templates (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keyInformationTemplate, GP211_KEY_INFORMATION *keyInformation, PDWORD keyInformationLength)
 GlobalPlatform2.1.1: Retrieves key information of keys on the card. More...
 
OPGP_ERROR_STATUS OPGP_parse_extended_card_resources_information (const BYTE *data, DWORD dataLength, OPGP_EXTENDED_CARD_RESOURCE_INFORMATION *extendedCardResourceInformation)
 Parses the extended card resources information response. More...
 
OPGP_ERROR_STATUS OPGP_get_extended_card_resources_information (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, OPGP_EXTENDED_CARD_RESOURCE_INFORMATION *extendedCardResourceInformation)
 Reads the extended card resource information (number of applications + free memory). More...
 
OPGP_ERROR_STATUS GP211_set_status (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE statusType, PBYTE AID, DWORD AIDLength, BYTE lifeCycleState)
 GlobalPlatform2.1.1: Sets the life cycle status of Applications, Security Domains or the Card Manager. More...
 
OPGP_ERROR_STATUS GP211_get_status (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE cardElement, BYTE format, GP211_APPLICATION_DATA *applData, GP211_EXECUTABLE_MODULES_DATA *executableData, PDWORD dataLength)
 GlobalPlatform2.1.1: Gets the life cycle status of Applications, the Issuer Security Domains, Security Domains and Executable Load Files and their privileges or information about Executable Modules of the Executable Load Files. More...
 
OPGP_ERROR_STATUS OPGP_extract_cap_file (OPGP_CSTRING fileName, PBYTE loadFileBuf, PDWORD loadFileBufSize)
 Extracts a CAP file into a buffer. More...
 
OPGP_ERROR_STATUS OPGP_cap_to_ijc (OPGP_CSTRING capFileName, OPGP_STRING ijcFileName)
 Converts a CAP file to an IJC file (Executable Load File). More...
 
OPGP_ERROR_STATUS OPGP_read_executable_load_file_parameters (OPGP_STRING loadFileName, OPGP_LOAD_FILE_PARAMETERS *loadFileParams)
 Reads the parameters of an Executable Load File. More...
 
OPGP_ERROR_STATUS OPGP_read_executable_load_file_parameters_from_buffer (PBYTE loadFileBuf, DWORD loadFileBufSize, OPGP_LOAD_FILE_PARAMETERS *loadFileParams)
 Receives Executable Load File as a buffer instead of a FILE. More...
 
OPGP_ERROR_STATUS GP211_load (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, GP211_DAP_BLOCK *loadFileDataBlockSignature, DWORD loadFileDataBlockSignatureLength, OPGP_STRING executableLoadFileName, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, OPGP_PROGRESS_CALLBACK *callback)
 GlobalPlatform2.1.1: Loads a Executable Load File (containing an application) to the card. More...
 
OPGP_ERROR_STATUS GP211_load_from_buffer (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, GP211_DAP_BLOCK *loadFileDataBlockSignature, DWORD loadFileDataBlockSignatureLength, PBYTE loadFileBuf, DWORD loadFileBufSize, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, OPGP_PROGRESS_CALLBACK *callback)
 GlobalPlatform2.1.1: Loads a Executable Load File (containing an application) from a buffer to the card. More...
 
OPGP_ERROR_STATUS GP211_install_for_load (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, PBYTE loadToken, DWORD loadTokenLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit)
 GlobalPlatform2.1.1: Prepares the card for loading an application. More...
 
OPGP_ERROR_STATUS GP211_install_for_install (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, DWORD installTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 GlobalPlatform2.1.1: Installs an application on the card. More...
 
OPGP_ERROR_STATUS GP211_install_for_install_and_make_selectable (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, DWORD installTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 GlobalPlatform2.1.1: Installs and makes an installed application selectable. More...
 
OPGP_ERROR_STATUS GP211_install_for_extradition (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, PBYTE extraditionToken, DWORD extraditionTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 GlobalPlatform2.1.1: Associates an application with another Security Domain. More...
 
OPGP_ERROR_STATUS GP211_install_for_registry_update (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, PBYTE registryUpdateParameters, DWORD registryUpdateParametersLength, PBYTE registryUpdateToken, DWORD registryUpdateTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 GlobalPlatform2.3.1: Updates the registry of an application or Security Domain. More...
 
OPGP_ERROR_STATUS GP211_install_for_personalization (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE applicationAID, DWORD applicationAIDLength)
 GlobalPlatform2.1.1: Informs a Security Domain that a associated application will retrieve personalization data. More...
 
OPGP_ERROR_STATUS GP211_install_for_make_selectable (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, PBYTE installToken, DWORD installTokenLength, GP211_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 GlobalPlatform2.1.1: Makes an installed application selectable. More...
 
OPGP_ERROR_STATUS GP211_get_install_token_signature_data (BYTE P1, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installTokenSignatureData, PDWORD installTokenSignatureDataLength)
 GlobalPlatform2.1.1: Function to retrieve the data to sign by the Card Issuer in an Install Token. More...
 
OPGP_ERROR_STATUS GP211_build_uicc_system_specific_params (GP211_UICC_SYSTEM_SPECIFIC_PARAMS *params, PBYTE uiccSystemSpecParams, PDWORD uiccSystemSpecParamsLength)
 GlobalPlatform2.1.1: Builds the UICC System Specific Parameters (tag 'EA' value without the tag and length). More...
 
OPGP_ERROR_STATUS GP211_build_sim_specific_params (GP211_SIM_SPECIFIC_PARAMS *params, PBYTE simSpecParams, PDWORD simSpecParamsLength)
 GlobalPlatform2.1.1: Builds the SIM File Access and Toolkit Application Specific Parameters (tag 'CA' value without the tag and length). More...
 
OPGP_ERROR_STATUS GP211_build_sd_parameters (GP211_SD_INSTALL_PARAMS *params, PBYTE sdParameters, PDWORD sdParametersLength)
 GlobalPlatform2.1.1: Builds the Security Domain install parameters (tag 'C1' with tag and length). More...
 
OPGP_ERROR_STATUS GP211_get_extradition_token_signature_data (PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, PBYTE extraditionTokenSignatureData, PDWORD extraditionTokenSignatureDataLength)
 GlobalPlatform2.1.1: Function to retrieve the data to sign by the Card Issuer in an Extradition Token. More...
 
OPGP_ERROR_STATUS GP211_get_registry_update_token_signature_data (PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, PBYTE registryUpdateParameters, DWORD registryUpdateParametersLength, PBYTE tokenSignatureData, PDWORD tokenSignatureDataLength)
 GlobalPlatform2.3.1: Function to retrieve the data to sign for delegated management in a Registry Update Token. More...
 
OPGP_ERROR_STATUS GP211_get_delete_token_signature_data (OPGP_AID *AIDs, DWORD AIDsLength, PBYTE deleteTokenSignatureData, PDWORD deleteTokenSignatureDataLength)
 GlobalPlatform2.3.1: Function to retrieve the data to sign for delegated management in a Delete Token. More...
 
OPGP_ERROR_STATUS GP211_calculate_install_token (BYTE P1, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE executableModuleAID, DWORD executableModuleAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE installParameters, DWORD installParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, PDWORD installTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.1.1: Calculates an Install Token using PKCS#1. More...
 
OPGP_ERROR_STATUS GP211_calculate_extradition_token (PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, PBYTE extraditionToken, PDWORD extraditionTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.1.1: Calculates an Extradition Token using PKCS#1. More...
 
OPGP_ERROR_STATUS GP211_calculate_update_registry_token (PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, DWORD applicationPrivileges, PBYTE registryUpdateParameters, DWORD registryUpdateParametersLength, PBYTE registryUpdateToken, PDWORD registryUpdateTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: Calculates a Registry Update Token using PKCS#1. More...
 
OPGP_ERROR_STATUS GP211_calculate_delete_token (PBYTE applicationOrExecutableLoadFileAID, DWORD applicationOrExecutableLoadFileAIDLength, PBYTE deleteToken, PDWORD deleteTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: Calculates a Delete Token using PKCS#1. More...
 
OPGP_ERROR_STATUS GP211_get_load_token_signature_data (PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE loadTokenSignatureData, PDWORD loadTokenSignatureDataLength)
 GlobalPlatform2.1.1: Function to retrieve the data to sign by the Card Issuer in a Load Token. More...
 
OPGP_ERROR_STATUS GP211_calculate_load_token (PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE loadToken, PDWORD loadTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.1.1: Calculates a Load Token using PKCS#1. More...
 
OPGP_ERROR_STATUS GP211_calculate_load_file_data_block_hash (OPGP_STRING executableLoadFileName, PBYTE hash, DWORD hashLength, BYTE hashType)
 GlobalPlatform2.1.1: Calculates a Load File Data Block Hash. More...
 
OPGP_ERROR_STATUS GP211_calculate_DAP (BYTE loadFileDataBlockHash[64], BYTE hashLength, BYTE DAPCalculationKey[32], DWORD keyLength, PBYTE signature, PDWORD signatureLength, BYTE secureChannelProtocol)
 GlobalPlatform2.1.1: Calculates a Load File Data Block Signature using AES or 3DES. More...
 
OPGP_ERROR_STATUS GP211_calculate_rsa_DAP (BYTE loadFileDataBlockHash[20], PBYTE securityDomainAID, DWORD securityDomainAIDLength, OPGP_STRING PEMKeyFileName, char *passPhrase, GP211_DAP_BLOCK *loadFileDataBlockSignature)
 GlobalPlatform2.1.1: Calculates a Load File Data Block Signature using SHA-1 and PKCS#1 (RSA). More...
 
OPGP_ERROR_STATUS GP211_calculate_rsa_schemeX_DAP (PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, OPGP_STRING PEMKeyFileName, char *passPhrase, PBYTE signature, PDWORD signatureLength)
 GlobalPlatform2.1.1: Calculates a Load File Data Block Signature using SHA-256/SHA-512 and RSA-PSS (Scheme 2). More...
 
OPGP_ERROR_STATUS GP211_calculate_ecc_DAP (PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, OPGP_STRING PEMKeyFileName, char *passPhrase, PBYTE signature, PDWORD signatureLength)
 GlobalPlatform2.3.1: Calculates an ECC Load File Data Block Signature in plain format (TR-03111 r||s). More...
 
OPGP_ERROR_STATUS GP211_validate_load_receipt (PBYTE receiptKey, DWORD keyLength, GP211_RECEIPT_DATA receiptData, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, BYTE receiptKeyType, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: Validates a Load Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys. More...
 
OPGP_ERROR_STATUS GP211_validate_install_receipt (PBYTE receiptKey, DWORD keyLength, GP211_RECEIPT_DATA receiptData, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, BYTE receiptKeyType, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: Validates an Install Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys. More...
 
OPGP_ERROR_STATUS GP211_validate_delete_receipt (PBYTE receiptKey, DWORD keyLength, GP211_RECEIPT_DATA receiptData, PBYTE AID, DWORD AIDLength, BYTE receiptKeyType, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: Validates a Delete Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys. More...
 
OPGP_ERROR_STATUS GP211_validate_extradition_receipt (PBYTE receiptKey, DWORD keyLength, GP211_RECEIPT_DATA receiptData, PBYTE oldSecurityDomainAID, DWORD oldSecurityDomainAIDLength, PBYTE newSecurityDomainAID, DWORD newSecurityDomainAIDLength, PBYTE applicationOrExecutableLoadFileAID, DWORD applicationOrExecutableLoadFileAIDLength, BYTE receiptKeyType, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: Validates an Extradition Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys. More...
 
OPGP_ERROR_STATUS GP211_validate_registry_update_receipt (PBYTE receiptKey, DWORD keyLength, GP211_RECEIPT_DATA receiptData, PBYTE oldSecurityDomainAID, DWORD oldSecurityDomainAIDLength, PBYTE applicationAID, DWORD applicationAIDLength, PBYTE newSecurityDomainAID, DWORD newSecurityDomainAIDLength, DWORD applicationPrivileges, PBYTE registryUpdateParameters, DWORD registryUpdateParametersLength, BYTE receiptKeyType, OPGP_STRING PEMKeyFileName, char *passPhrase)
 GlobalPlatform2.3.1: Validates a Registry Update Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys. More...
 
OPGP_ERROR_STATUS OP201_VISA2_derive_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE AID, DWORD AIDLength, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the VISA 2 key derivation scheme. More...
 
OPGP_ERROR_STATUS GP211_VISA2_derive_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE AID, DWORD AIDLength, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the VISA 2 key derivation scheme. More...
 
OPGP_ERROR_STATUS VISA2_derive_keys (BYTE baseKeyDiversificationData[10], PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the VISA 2 key derivation scheme. More...
 
OPGP_ERROR_STATUS OP201_VISA1_derive_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the VISA 1 key derivation scheme. More...
 
OPGP_ERROR_STATUS GP211_VISA1_derive_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the VISA 1 key derivation scheme. More...
 
OPGP_ERROR_STATUS VISA1_derive_keys (BYTE cardSerialNumber[8], PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the VISA 1 key derivation scheme. More...
 
OPGP_ERROR_STATUS OP201_EMV_CPS11_derive_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the EMV CPS 1.1 key derivation scheme. More...
 
OPGP_ERROR_STATUS GP211_EMV_CPS11_derive_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the EMV CPS 1.1 key derivation scheme. More...
 
OPGP_ERROR_STATUS EMV_CPS11_derive_keys (BYTE baseKeyDiversificationData[10], PBYTE masterKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK)
 Derives the static keys from a master key according the EMV CPS11 derivation scheme. More...
 
OPGP_ERROR_STATUS GP211_mutual_authentication (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, PBYTE baseKeyOrStaticOcePrivateKey, PBYTE S_ENC, PBYTE S_MAC, PBYTE DEK, DWORD keyLength, BYTE keySetVersion, BYTE keyIndex, BYTE secureChannelProtocol, BYTE secureChannelProtocolImpl, BYTE securityLevel, BYTE derivationMethod, PBYTE certOceEcka, DWORD certOceEckaLength, PBYTE sdPublicKeyOverride, DWORD sdPublicKeyOverrideLength, OPGP_STRING sdPublicKeyFileName, GP211_SECURITY_INFO *secInfo)
 GlobalPlatform2.1.1: Mutual authentication. More...
 
OPGP_ERROR_STATUS GP211_init_implicit_secure_channel (PBYTE AID, DWORD AIDLength, BYTE baseKey[16], BYTE S_ENC[16], BYTE S_MAC[16], BYTE DEK[16], BYTE secureChannelProtocolImpl, BYTE sequenceCounter[2], GP211_SECURITY_INFO *secInfo)
 GlobalPlatform2.1.1: Inits a Secure Channel implicitly. More...
 
OPGP_ERROR_STATUS GP211_get_sequence_counter (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, DWORD *sequenceCounter)
 GlobalPlatform2.1.1: This returns the current Sequence Counter. More...
 
OPGP_ERROR_STATUS GP211_get_confirmation_counter (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, DWORD *confirmationCounter)
 GlobalPlatform2.1.1: This returns the confirmation counter. More...
 
OPGP_ERROR_STATUS GP211_close_implicit_secure_channel (GP211_SECURITY_INFO *secInfo)
 GlobalPlatform2.1.1: Closes a Secure Channel implicitly. More...
 
OPGP_ERROR_STATUS GP211_pin_change (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE tryLimit, PBYTE newPIN, DWORD newPINLength)
 GlobalPlatform2.1.1: Changes or unblocks the global PIN. More...
 
OPGP_ERROR_STATUS GP211_store_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE encryptionFlags, BYTE formatFlags, BOOL responseDataExpected, PBYTE data, DWORD dataLength)
 GlobalPlatform2.1.1: The STORE DATA command is used to transfer data to an Application or the Security Domain processing the command. More...
 
OPGP_ERROR_STATUS GP211_store_data_ecka_certificate (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keyVersionNumber, BYTE keyIdentifier, OPGP_STRING certificateStoreFileName)
 SCP11: STORE DATA for the ECKA certificate store (section 6.7). More...
 
OPGP_ERROR_STATUS GP211_store_data_whitelist (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, BYTE keyVersionNumber, BYTE keyIdentifier, BOOL whitelistCounterPresent, USHORT whitelistCounter, PBYTE *certificateSerialNumbers, PDWORD certificateSerialNumberLengths, DWORD certificateSerialNumberCount)
 SCP11: STORE DATA for a whitelist linked to a PK.CA-KLOC.ECDSA (section 6.8). More...
 
OPGP_ERROR_STATUS GP211_store_data_ca_kloc_kid_kvn (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE caKlocIdentifier, DWORD caKlocIdentifierLength, BYTE keyIdentifier, BYTE keyVersionNumber)
 SCP11: STORE DATA for a CA-KLOC Identifier to PK.CA-KLOC.ECDSA mapping (section 6.9). More...
 
OPGP_ERROR_STATUS GP211_build_store_data_keys (BYTE scp, BYTE scpImpl, PBYTE dataEncryptionKey, DWORD dataEncryptionKeyLength, BYTE keyType, USHORT keyPurpose, PBYTE keys[], BYTE keyIds[], DWORD numKeys, DWORD keyLength, BYTE keyVersion, BYTE keyAccessCondition, PBYTE output, PDWORD outputLength)
 GlobalPlatform2.3.1: Builds STORE DATA encoding for symmetric keys according to section 11.11.4. More...
 
OPGP_ERROR_STATUS GP211_store_secure_channel_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, GP211_SECURITY_INFO *secInfo, PBYTE AID, DWORD AIDLength, BYTE keyType, PBYTE baseKey, PBYTE newS_ENC, PBYTE newS_MAC, PBYTE newDEK, DWORD keyLength, BYTE keySetVersion, BYTE keyAccessCondition)
 GlobalPlatform2.3.1: STORE DATA command for storing secure channel keys using the symmetric key format. More...
 
OPGP_ERROR_STATUS OPGP_select_channel (OPGP_CARD_INFO *cardInfo, BYTE channelNumber)
 ISO 7816-4 / GlobalPlatform2.1.1: If multiple Logical Channels are open or a new Logical Channel is opened with select_application(), selects the Logical Channel. More...
 
OPGP_ERROR_STATUS OPGP_manage_channel (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO *cardInfo, GP211_SECURITY_INFO *secInfo, BYTE openClose, BYTE channelNumberToClose, BYTE *channelNumberOpened)
 ISO 7816-4 / GlobalPlatform2.1.1: Opens or closes a Logical Channel. More...
 
OPGP_ERROR_STATUS OP201_send_APDU (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE capdu, DWORD capduLength, PBYTE rapdu, PDWORD rapduLength)
 Sends an application protocol data unit. More...
 
OPGP_ERROR_STATUS OP201_put_rsa_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase)
 Open Platform: replaces a single public RSA key in a key set or adds a new public RSA key. More...
 
OPGP_ERROR_STATUS OP201_put_3desKey (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex, BYTE newKeySetVersion, BYTE _3desKey[16])
 Open Platform: replaces a single 3DES key in a key set or adds a new 3DES key. More...
 
OPGP_ERROR_STATUS OP201_put_secure_channel_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, BYTE new_encKey[16], BYTE new_macKey[16], BYTE new_KEK[16])
 Open Platform: replaces or adds a secure channel key set consisting of encryption key, MAC key and key encryption. More...
 
OPGP_ERROR_STATUS OP201_put_delegated_management_keys (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE newKeySetVersion, OPGP_STRING PEMKeyFileName, char *passPhrase, BYTE receiptGenerationKey[16])
 Open Platform: Adds a key set for Delegated Management. More...
 
OPGP_ERROR_STATUS OP201_delete_key (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE keySetVersion, BYTE keyIndex)
 Open Platform: deletes a key or multiple keys. More...
 
OPGP_ERROR_STATUS OP201_delete_application (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, OPGP_AID *AIDs, DWORD AIDsLength, OP201_RECEIPT_DATA *receiptData, PDWORD receiptDataLength)
 Open Platform: Deletes a Executable Load File or an application. More...
 
OPGP_ERROR_STATUS OP201_put_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE identifier[2], PBYTE dataObject, DWORD dataObjectLength)
 Open Platform: Put card data. More...
 
OPGP_ERROR_STATUS OP201_get_data (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE identifier[2], PBYTE recvBuffer, PDWORD recvBufferLength)
 Open Platform: Retrieve card data. More...
 
OPGP_ERROR_STATUS OP201_get_key_information_templates (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE keyInformationTemplate, OP201_KEY_INFORMATION *keyInformation, PDWORD keyInformationLength)
 Open Platform: Retrieves key information of keys on the card. More...
 
OPGP_ERROR_STATUS OP201_set_status (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE statusType, PBYTE AID, DWORD AIDLength, BYTE lifeCycleState)
 Open Platform: Sets the life cycle status of Applications, Security Domains or the Card Manager. More...
 
OPGP_ERROR_STATUS OP201_get_status (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE cardElement, OP201_APPLICATION_DATA *applData, PDWORD applDataLength)
 Open Platform: Gets the life cycle status of Applications, the Card Manager and Executable Load Files and their privileges. More...
 
OPGP_ERROR_STATUS OP201_load (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, OP201_DAP_BLOCK *dapBlock, DWORD dapBlockLength, OPGP_STRING executableLoadFileName, OP201_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, OPGP_PROGRESS_CALLBACK *callback)
 Open Platform: Loads a Executable Load File (containing an application) to the card. More...
 
OPGP_ERROR_STATUS OP201_load_from_buffer (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, OP201_DAP_BLOCK *dapBlock, DWORD dapBlockLength, PBYTE loadFileBuf, DWORD loadFileBufSize, OP201_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable, OPGP_PROGRESS_CALLBACK *callback)
 Open Platform: Loads a Executable Load File (containing an application) from a buffer to the card. More...
 
OPGP_ERROR_STATUS OP201_install_for_load (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, PBYTE loadToken, DWORD loadTokenLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit)
 Open Platform: Prepares the card for loading an application. More...
 
OPGP_ERROR_STATUS OP201_install_for_install (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE AIDWithinLoadFileAID, DWORD AIDWithinLoadFileAIDLength, PBYTE applicationInstanceAID, DWORD applicationInstanceAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE applicationInstallParameters, DWORD applicationInstallParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, DWORD installTokenLength, OP201_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 Open Platform: Installs an application on the card. More...
 
OPGP_ERROR_STATUS OP201_install_for_install_and_make_selectable (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE AIDWithinLoadFileAID, DWORD AIDWithinLoadFileAIDLength, PBYTE applicationInstanceAID, DWORD applicationInstanceAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE applicationInstallParameters, DWORD applicationInstallParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, DWORD installTokenLength, OP201_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 Open Platform: Installs and makes an installed application selectable. More...
 
OPGP_ERROR_STATUS OP201_install_for_make_selectable (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, PBYTE applicationInstanceAID, DWORD applicationInstanceAIDLength, DWORD applicationPrivileges, PBYTE installToken, DWORD installTokenLength, OP201_RECEIPT_DATA *receiptData, PDWORD receiptDataAvailable)
 Open Platform: Makes an installed application selectable. More...
 
OPGP_ERROR_STATUS OP201_get_install_token_signature_data (BYTE P1, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE AIDWithinLoadFileAID, DWORD AIDWithinLoadFileAIDLength, PBYTE applicationInstanceAID, DWORD applicationInstanceAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE applicationInstallParameters, DWORD applicationInstallParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installTokenSignatureData, PDWORD installTokenSignatureDataLength)
 Open Platform: Function to retrieve the data to sign for delegated management in an Install Token. More...
 
OPGP_ERROR_STATUS OP201_calculate_install_token (BYTE P1, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE AIDWithinLoadFileAID, DWORD AIDWithinLoadFileAIDLength, PBYTE applicationInstanceAID, DWORD applicationInstanceAIDLength, DWORD applicationPrivileges, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE applicationInstallParameters, DWORD applicationInstallParametersLength, PBYTE sdParameters, DWORD sdParametersLength, PBYTE uiccSystemSpecParams, DWORD uiccSystemSpecParamsLength, PBYTE simSpecParams, DWORD simSpecParamsLength, PBYTE installToken, PDWORD installTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 Open Platform: Calculates an Install Token using PKCS#1. More...
 
OPGP_ERROR_STATUS OP201_get_load_token_signature_data (PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDataBlockHash, DWORD loadFileDataBlockHashLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE loadTokenSignatureData, PDWORD loadTokenSignatureDataLength)
 Open Platform: Function to retrieve the data to sign for delegated management in a Load Token. More...
 
OPGP_ERROR_STATUS OP201_calculate_load_token (PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, PBYTE loadFileDAP, DWORD loadFileDAPLength, DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE loadToken, PDWORD loadTokenLength, OPGP_STRING PEMKeyFileName, char *passPhrase)
 Open Platform: Calculates a Load Token using PKCS#1. More...
 
OPGP_ERROR_STATUS OP201_calculate_load_file_DAP (OP201_DAP_BLOCK *dapBlock, DWORD dapBlockLength, OPGP_STRING executableLoadFileName, BYTE hash[20])
 Open Platform: Calculates a Load File DAP. More...
 
OPGP_ERROR_STATUS OP201_calculate_3des_DAP (PBYTE securityDomainAID, DWORD securityDomainAIDLength, OPGP_STRING executableLoadFileName, BYTE DAP_verification_key[16], OP201_DAP_BLOCK *dapBlock)
 Open Platform: Calculates a Load File Data Block DAP using 3DES. More...
 
OPGP_ERROR_STATUS OP201_calculate_rsa_DAP (PBYTE securityDomainAID, DWORD securityDomainAIDLength, OPGP_STRING executableLoadFileName, OPGP_STRING PEMKeyFileName, char *passPhrase, OP201_DAP_BLOCK *dapBlock)
 Open Platform: Calculates a Load File Data Block DAP using SHA-1 and PKCS#1 (RSA). More...
 
OPGP_ERROR_STATUS OP201_validate_load_receipt (DWORD confirmationCounter, BYTE cardUniqueData[10], BYTE receiptGenerationKey[16], OP201_RECEIPT_DATA receiptData, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength)
 Open Platform: Validates a Load Receipt. More...
 
OPGP_ERROR_STATUS OP201_validate_install_receipt (DWORD confirmationCounter, BYTE cardUniqueData[10], BYTE receiptGenerationKey[16], OP201_RECEIPT_DATA receiptData, PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE applicationInstanceAID, DWORD applicationInstanceAIDLength)
 Open Platform: Validates an Install Receipt. More...
 
OPGP_ERROR_STATUS OP201_validate_delete_receipt (DWORD confirmationCounter, BYTE cardUniqueData[10], BYTE receiptGenerationKey[16], OP201_RECEIPT_DATA receiptData, PBYTE AID, DWORD AIDLength)
 Open Platform: Validates a Load Receipt. More...
 
OPGP_ERROR_STATUS OP201_pin_change (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, OP201_SECURITY_INFO *secInfo, BYTE tryLimit, PBYTE newPIN, DWORD newPINLength, BYTE KEK[16])
 Open Platform: Changes or unblocks the global PIN. More...
 
OPGP_ERROR_STATUS OP201_mutual_authentication (OPGP_CARD_CONTEXT cardContext, OPGP_CARD_INFO cardInfo, PBYTE baseKey, PBYTE encKey, PBYTE macKey, PBYTE kekKey, BYTE keySetVersion, BYTE keyIndex, BYTE securityLevel, BYTE derivationMethod, OP201_SECURITY_INFO *secInfo)
 Open Platform: Mutual authentication. More...
 
OPGP_ERROR_STATUS OPGP_calculate_key_check_value (GP211_SECURITY_INFO *secInfo, BYTE keyType, PBYTE keyData, DWORD keyDataLength, BYTE keyCheckValue[3])
 Calculates the key check value of a key. More...
 
OPGP_ERROR_STATUS OPGP_encrypt_sensitive_data (GP211_SECURITY_INFO *secInfo, PBYTE data, DWORD dataLength, PBYTE encryptedData, PDWORD encryptedDataLength)
 Encrypts sensitive data like keys or other data which is used in STORE DATA. More...
 

Detailed Description

This implements all Open- and GlobalPlatform functions.

Macro Definition Documentation

◆ CHECK_SW_9000

#define CHECK_SW_9000 (   recvBuffer,
  recvBufferLength,
  status 
)
Value:
if (recvBuffer[recvBufferLength-2] != 0x90 || recvBuffer[recvBufferLength-1] != 0x00) {\
OPGP_ERROR_CREATE_ERROR(status, status.errorCode, OPGP_stringify_error(status.errorCode)); \
goto end; \
}
OPGP_API OPGP_STRING OPGP_stringify_error(DWORD errorCode)
Stringifies the error.
Definition: stringify.c:50

Macro to check for the status word 9000, otherwise the status is set to the error and a jump to the end mark takes place.

Function Documentation

◆ delete_application()

OPGP_ERROR_STATUS delete_application ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
OPGP_AID AIDs,
DWORD  AIDsLength,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable,
PBYTE  deleteToken,
DWORD  deleteTokenLength,
DWORD  mode 
)
Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
AIDs[in] A pointer to the an array of OPGP_AID structures describing the applications and load files to delete.
AIDsLength[in] The number of OPGP_AID structures.
*receiptData[out] A GP211_RECEIPT_DATA structure. If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
deleteToken[in] Optional delete token value. If present, it is encoded with tag '9F'.
deleteTokenLength[in] The length of the deleteToken buffer.
modeOpenPlatform 2.0.1' or GlobalPlatform 2.1.1 delete command.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ EMV_CPS11_derive_keys()

OPGP_ERROR_STATUS EMV_CPS11_derive_keys ( BYTE  baseKeyDiversificationData[10],
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the EMV CPS11 derivation scheme.

Derives static Secure Channel keys using the EMV CPS 1.1 derivation scheme. The baseKeyDiversificationData buffer must contain the 10 byte KEYDATA value used by the card for INITIALIZE UPDATE.

Parameters
baseKeyDiversificationData[in] The 10 byte EMV CPS 1.1 key diversification data.
masterKey[in] The master key.
S_ENC[out] The derived static Encryption key.
S_MAC[out] The derived static Message Authentication Code key.
DEK[out] The derived static Data Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_begin_R_MAC()

OPGP_ERROR_STATUS GP211_begin_R_MAC ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  securityLevel,
PBYTE  data,
DWORD  dataLength 
)

Initiates a R-MAC session.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
securityLevelLevel of security for all subsequent commands
  • GP211_SCP02_SECURITY_LEVEL_R_MAC - Each APDU response contains a R-MAC during the session.
  • GP211_SCP02_SECURITY_LEVEL_NO_SECURE_MESSAGING - Only the END R-MAC SESSION response message will contain a R-MAC.
  • GP211_SCP03_SECURITY_LEVEL_R_MAC - Each APDU response contains a R-MAC during the session.
  • GP211_SCP03_SECURITY_LEVEL_R_ENC_R_MAC - Each APDU response contains a R-MAC and R-encryption during the session.
data[in] Data for the BEGIN R-MAC SESSION command, e.g. extra challenge.
dataLength[in] Length of data.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_build_card_recognition_data()

OPGP_ERROR_STATUS GP211_build_card_recognition_data ( const GP211_CARD_RECOGNITION_DATA cardData,
PBYTE  data,
PDWORD  dataLength 
)

Builds the card recognition data response.

Builds a GlobalPlatform Card Recognition Data response. The output is encoded as tag 66 containing tag 73 with the card recognition OID, card management version OID, card identification scheme OID, SCP OIDs and optional card detail templates from GP211_CARD_RECOGNITION_DATA.

Parameters
cardData[in] The card recognition data to encode.
data[out] The output buffer for the encoded response.
dataLength[in, out] The length of data and, on success, the number of encoded bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_build_scp11_certificate()

OPGP_ERROR_STATUS GP211_build_scp11_certificate ( GP211_SCP11_CERTIFICATE certificate,
OPGP_STRING  subjectPublicKeyFileName,
char *  subjectPublicKeyPassPhrase,
OPGP_STRING  signingPrivateKeyFileName,
char *  signingPrivateKeyPassPhrase,
PBYTE  certificateData,
PDWORD  certificateDataLength 
)

SCP11: Builds and signs a certificate encoded according to table 6-12.

Builds and signs an SCP11 certificate encoded according to table 6-12. The signed data is generated according to table 6-13. If subjectPublicKeyFileName is provided, the public key Q and key parameter reference are extracted from the OpenSSL EC public or private key file before signing.

Parameters
certificate[in, out] The certificate fields. The public key and signature fields are updated.
subjectPublicKeyFileName[in] OpenSSL EC public or private key file for the certificate subject, or NULL to use certificate->publicKey.
subjectPublicKeyPassPhrase[in] Passphrase for subjectPublicKeyFileName, or NULL if not needed.
signingPrivateKeyFileName[in] OpenSSL EC private key file used to sign the certificate.
signingPrivateKeyPassPhrase[in] Passphrase for signingPrivateKeyFileName, or NULL if not needed.
certificateData[out] The encoded 7F21 certificate.
certificateDataLength[in, out] The length of certificateData and, on success, the number of encoded bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_build_sd_parameters()

OPGP_ERROR_STATUS GP211_build_sd_parameters ( GP211_SD_INSTALL_PARAMS params,
PBYTE  sdParameters,
PDWORD  sdParametersLength 
)

GlobalPlatform2.1.1: Builds the Security Domain install parameters (tag 'C1' with tag and length).

Builds Security Domain install parameters. The output is the value of tag C1, including the nested tags and lengths for SCP entries, extradition/deletion policies, personalized-state marker, CASD capability information and extradition-away policy.

Parameters
params[in] The structured Security Domain install parameters to encode.
sdParameters[out] The output buffer for the encoded parameters.
sdParametersLength[in, out] The length of sdParameters and, on success, the number of encoded bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_build_sim_specific_params()

OPGP_ERROR_STATUS GP211_build_sim_specific_params ( GP211_SIM_SPECIFIC_PARAMS params,
PBYTE  simSpecParams,
PDWORD  simSpecParamsLength 
)

GlobalPlatform2.1.1: Builds the SIM File Access and Toolkit Application Specific Parameters (tag 'CA' value without the tag and length).

Builds the SIM File Access and Toolkit Application Specific Parameters value. The output is the value of tag CA without the tag and length bytes.

Parameters
params[in] The structured SIM specific parameters to encode.
simSpecParams[out] The output buffer for the encoded parameters.
simSpecParamsLength[in, out] The length of simSpecParams and, on success, the number of encoded bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_build_store_data_keys()

OPGP_ERROR_STATUS GP211_build_store_data_keys ( BYTE  scp,
BYTE  scpImpl,
PBYTE  dataEncryptionKey,
DWORD  dataEncryptionKeyLength,
BYTE  keyType,
USHORT  keyPurpose,
PBYTE  keys[],
BYTE  keyIds[],
DWORD  numKeys,
DWORD  keyLength,
BYTE  keyVersion,
BYTE  keyAccessCondition,
PBYTE  output,
PDWORD  outputLength 
)

GlobalPlatform2.3.1: Builds STORE DATA encoding for symmetric keys according to section 11.11.4.

Builds STORE DATA encoding for symmetric keys according to GlobalPlatform v2.3.1.49 section 11.11.4.

Parameters
scp[in] The secure channel protocol. See GP211_SCP03.
scpImpl[in] The secure channel protocol implementation. See GP211_SCP03_IMPL_i04.
dataEncryptionKey[in] The data encryption key for encrypting sensitive data.
dataEncryptionKeyLength[in] The length of the data encryption key in bytes.
keyType[in] The key type. See GP211_KEY_TYPE_AES.
keyPurpose[in] The key purpose. See GP211_KEY_PURPOSE_SCP03.
keys[in] Array of key data pointers.
keyIds[in] Array of key identifiers.
numKeys[in] Number of keys.
keyLength[in] The key length in bytes.
keyVersion[in] The key version number.
keyAccessCondition[in] The key access condition. See GP211_KEY_ACCESS_SD_AND_APPS.
output[out] The output buffer for the encoded data.
outputLength[in, out] The available and returned length of the output buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_build_uicc_system_specific_params()

OPGP_ERROR_STATUS GP211_build_uicc_system_specific_params ( GP211_UICC_SYSTEM_SPECIFIC_PARAMS params,
PBYTE  uiccSystemSpecParams,
PDWORD  uiccSystemSpecParamsLength 
)

GlobalPlatform2.1.1: Builds the UICC System Specific Parameters (tag 'EA' value without the tag and length).

Builds the UICC System Specific Parameters value. The output is the value of tag EA without the tag and length bytes.

Parameters
params[in] The structured UICC system specific parameters to encode.
uiccSystemSpecParams[out] The output buffer for the encoded parameters.
uiccSystemSpecParamsLength[in, out] The length of uiccSystemSpecParams and, on success, the number of encoded bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_ca_kloc_kid_kvn()

OPGP_ERROR_STATUS GP211_ca_kloc_kid_kvn ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  caKlocIdentifier,
DWORD  caKlocIdentifierLength,
BYTE keyIdentifier,
BYTE keyVersionNumber 
)

SCP11: Resolves KID/KVN from a CA-KLOC Identifier (GET DATA with tag 0083).

Resolves the SCP11 CA-KLOC Identifier to a Key Identifier and Key Version Number. The command sends GET DATA tag 0083 with the CA-KLOC Identifier in tag 42 and expects a tag 83 response containing KID || KVN.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication(), or NULL if the command is sent without secure messaging.
caKlocIdentifier[in] The CA-KLOC Identifier value.
caKlocIdentifierLength[in] The length of caKlocIdentifier.
keyIdentifier[out] The resolved Key Identifier (KID).
keyVersionNumber[out] The resolved Key Version Number (KVN).
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_calculate_DAP()

OPGP_ERROR_STATUS GP211_calculate_DAP ( BYTE  loadFileDataBlockHash[64],
BYTE  hashLength,
BYTE  DAPCalculationKey[32],
DWORD  keyLength,
PBYTE  signature,
PDWORD  signatureLength,
BYTE  secureChannelProtocol 
)

GlobalPlatform2.1.1: Calculates a Load File Data Block Signature using AES or 3DES.

This is used with SCP02 or SCP03. If a security domain has DAP verification privilege the security domain validates this DAP. The loadFileDataBlockHash can be calculated using calculate_load_file_data_block_hash().

Parameters
loadFileDataBlockHash[in] The Load File Data Block Hash. Must be a SHA-256, SHA-384 or SHA-512 hash.
hashLength[in] The length of the hash.
DAPCalculationKey[in] The key to calculate the DAP.
keyLength[in] The key length of the DAPCalculationKey.
signature[out] Output buffer for the raw DAP signature bytes.
signatureLength[in,out] Input: size of signature buffer. Output: generated signature length.
secureChannelProtocol[in] The Secure Channel Protocol.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_delete_token()

OPGP_ERROR_STATUS GP211_calculate_delete_token ( PBYTE  applicationOrExecutableLoadFileAID,
DWORD  applicationOrExecutableLoadFileAIDLength,
PBYTE  deleteToken,
PDWORD  deleteTokenLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: Calculates a Delete Token using PKCS#1.

The parameters must match the parameters of a later GP211_delete_application() method.

Parameters
applicationOrExecutableLoadFileAID[in] A buffer containing the AID of the application or executable load file.
applicationOrExecutableLoadFileAIDLength[in] The length of the AID buffer.
deleteToken[out] The calculated Delete Token.
deleteTokenLength[in, out] The length of the deleteToken buffer.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_ecc_DAP()

OPGP_ERROR_STATUS GP211_calculate_ecc_DAP ( PBYTE  loadFileDataBlockHash,
DWORD  loadFileDataBlockHashLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
PBYTE  signature,
PDWORD  signatureLength 
)

GlobalPlatform2.3.1: Calculates an ECC Load File Data Block Signature in plain format (TR-03111 r||s).

Calculates an ECC Load File Data Block Signature according to GlobalPlatform Card Specification 2.3.1. The returned signature is encoded in plain format according to BSI TR-03111 (r||s).

Parameters
loadFileDataBlockHash[in] The Load File Data Block Hash to sign.
loadFileDataBlockHashLength[in] The length of the Load File Data Block Hash.
PEMKeyFileName[in] A PEM file name with the private ECC key.
*passPhrase[in] The passphrase. Must be an ASCII string.
signature[out] Output buffer for the raw DAP signature bytes.
signatureLength[in,out] Input: size of signature buffer. Output: generated signature length.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_extradition_token()

OPGP_ERROR_STATUS GP211_calculate_extradition_token ( PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
PBYTE  extraditionToken,
PDWORD  extraditionTokenLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.1.1: Calculates an Extradition Token using PKCS#1.

The parameters must match the parameters of a later GP211_install_for_extradition() method.

Parameters
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
applicationAID[in] The AID of the installed application.
applicationAIDLength[in] The length of the application instance AID.
extraditionToken[out] The calculated Extradition Token.
extraditionTokenLength[in, out] The length of the extraditionToken buffer.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_install_token()

OPGP_ERROR_STATUS GP211_calculate_install_token ( BYTE  P1,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  executableModuleAID,
DWORD  executableModuleAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  installParameters,
DWORD  installParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installToken,
PDWORD  installTokenLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.1.1: Calculates an Install Token using PKCS#1.

The parameters must match the parameters of a later GP211_install_for_install(), GP211_install_for_make_selectable() and GP211_install_for_install_and_make_selectable() method.

Parameters
P1[in] The parameter P1 in the APDU command.
  • 0x04 for a INSTALL [for install] command
  • 0x08 for an INSTALL [for make selectable] command
  • 0x0C for an INSTALL [for install and make selectable]
  • 0x10 for an INSTALL [for extradiction]
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for install].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
executableModuleAID[in] The AID of the application class in the package.
executableModuleAIDLength[in] The length of the executableModuleAID buffer.
applicationAID[in] The AID of the installed application.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See GP211_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
installParameters[in] Applet install parameters for the install() method of the application.
installParametersLength[in] The length of the installParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installToken[out] The calculated Install Token. A 1024 bit RSA signature.
installTokenLength[in, out] The length of the installToken buffer.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_load_file_data_block_hash()

OPGP_ERROR_STATUS GP211_calculate_load_file_data_block_hash ( OPGP_STRING  executableLoadFileName,
PBYTE  hash,
DWORD  hashLength,
BYTE  hashType 
)

GlobalPlatform2.1.1: Calculates a Load File Data Block Hash.

This is a hash of the Load File Data Block with SHA-1 for SCP02 or SHA-256, SHA-384, SHA-512 or SM3 for SCP03.

Parameters
executableLoadFileName[in] The name of the Executable Load File to hash.
hash[out] The hash value.
hashLength[in] The hash length for SCP03: 32 for AES-128, 48 for AES-192, 64 for AES-256, 32 for SM3.
hashType[in] The hash type. See GP211_HASH_SHA256.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_load_token()

OPGP_ERROR_STATUS GP211_calculate_load_token ( PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  loadFileDataBlockHash,
DWORD  loadFileDataBlockHashLength,
DWORD  nonVolatileCodeSpaceLimit,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  loadToken,
PDWORD  loadTokenLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.1.1: Calculates a Load Token using PKCS#1.

The parameters must match the parameters of a later GP211_install_for_load() method.

Parameters
executableLoadFileAID[in] A buffer containing the Executable Load File AID.
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
loadFileDataBlockHash[in] The Load File DAP. The same calculated as in GP211_install_for_load().
loadFileDataBlockHashLength[in] The length of the loadFileDataBlockHash buffer.
nonVolatileCodeSpaceLimit[in] The minimum space required to store the package.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
loadToken[out] The calculated Load Token. A 1024 bit RSA signature.
loadTokenLength[in, out] The length of the loadToken buffer.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_rsa_DAP()

OPGP_ERROR_STATUS GP211_calculate_rsa_DAP ( BYTE  loadFileDataBlockHash[20],
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
GP211_DAP_BLOCK loadFileDataBlockSignature 
)

GlobalPlatform2.1.1: Calculates a Load File Data Block Signature using SHA-1 and PKCS#1 (RSA).

If a security domain has DAP verification privilege the security domain validates this DAP. The loadFileDataBlockHash can be calculated using calculate_load_file_data_block_hash().

Parameters
loadFileDataBlockHash[in] The Load File Data Block Hash.
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
PEMKeyFileName[in] A PEM file name with the DAP Verification private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
*loadFileDataBlockSignature[out] A pointer to the returned GP211_DAP_BLOCK structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_rsa_schemeX_DAP()

OPGP_ERROR_STATUS GP211_calculate_rsa_schemeX_DAP ( PBYTE  loadFileDataBlockHash,
DWORD  loadFileDataBlockHashLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
PBYTE  signature,
PDWORD  signatureLength 
)

GlobalPlatform2.1.1: Calculates a Load File Data Block Signature using SHA-256/SHA-512 and RSA-PSS (Scheme 2).

Calculates a Load File Data Block Signature according to the GlobalPlatform specification 2.1.1. This function supports RSA keys larger than 1024 bits using RSA-PSS (Scheme 2). Uses SHA-256 for RSA keys <= 2048 bits and SHA-512 for RSA keys > 2048 bits.

Parameters
loadFileDataBlockHash[in] The Load File Data Block Hash to sign.
loadFileDataBlockHashLength[in] The length of the Load File Data Block Hash.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
signature[out] Output buffer for the raw DAP signature bytes.
signatureLength[in,out] Input: size of signature buffer. Output: generated signature length.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_calculate_update_registry_token()

OPGP_ERROR_STATUS GP211_calculate_update_registry_token ( PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
PBYTE  registryUpdateParameters,
DWORD  registryUpdateParametersLength,
PBYTE  registryUpdateToken,
PDWORD  registryUpdateTokenLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: Calculates a Registry Update Token using PKCS#1.

The parameters must match the parameters of a later GP211_install_for_registry_update() method.

Parameters
securityDomainAID[in] A buffer containing the target Security Domain AID.
securityDomainAIDLength[in] The length of the target Security Domain AID.
applicationAID[in] The AID of the application.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges.
registryUpdateParameters[in] The Registry Update Parameters.
registryUpdateParametersLength[in] The length of the Registry Update Parameters.
registryUpdateToken[out] The calculated Registry Update Token.
registryUpdateTokenLength[in, out] The length of the registryUpdateToken buffer.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_close_implicit_secure_channel()

OPGP_ERROR_STATUS GP211_close_implicit_secure_channel ( GP211_SECURITY_INFO secInfo)

GlobalPlatform2.1.1: Closes a Secure Channel implicitly.

Parameters
*secInfo[out] The returned GP211_SECURITY_INFO structure.

◆ GP211_delete_application()

OPGP_ERROR_STATUS GP211_delete_application ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
OPGP_AID AIDs,
DWORD  AIDsLength,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable,
PBYTE  deleteToken,
DWORD  deleteTokenLength 
)

GlobalPlatform2.1.1: Deletes a Executable Load File or an application.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
AIDs[in] A pointer to the an array of OPGP_AID structures describing the applications and load files to delete.
AIDsLength[in] The number of OPGP_AID structures.
*receiptData[out] A GP211_RECEIPT_DATA structure. If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
deleteToken[in] Optional delete token value. If present, it is encoded with tag '9F'.
deleteTokenLength[in] The length of the deleteToken buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_delete_key()

OPGP_ERROR_STATUS GP211_delete_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex 
)

GlobalPlatform2.1.1: deletes a key or multiple keys.

If keyIndex is 0xFF all keys within a keySetVersion are deleted. If keySetVersion is 0x00 all keys with the specified keyIndex are deleted.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] An existing key index.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_EMV_CPS11_derive_keys()

OPGP_ERROR_STATUS GP211_EMV_CPS11_derive_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the EMV CPS 1.1 key derivation scheme.

E.g. Sm@rtCafe Expert 3.0 cards use this scheme.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_end_R_MAC()

OPGP_ERROR_STATUS GP211_end_R_MAC ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  secureChannelProtocol 
)

Terminates a R-MAC session.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
secureChannelProtocol[in] The security channel protocol.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_card_capability_information()

OPGP_ERROR_STATUS GP211_get_card_capability_information ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
GP211_CARD_CAPABILITY_INFORMATION cardCapabilityInfo 
)

GlobalPlatform2.3.1: Return the card capability information.

Can only be executed before a secure channel is created.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
*cardCapabilityInfo[out] A pointer to the card capability information.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_card_recognition_data()

OPGP_ERROR_STATUS GP211_get_card_recognition_data ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
GP211_CARD_RECOGNITION_DATA cardData 
)

GlobalPlatform2.1.1: Return the card recognition data.

Can only be executed before a secure channel is created.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
*cardData[out] A pointer to the card recognition data.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_confirmation_counter()

OPGP_ERROR_STATUS GP211_get_confirmation_counter ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
DWORD confirmationCounter 
)

GlobalPlatform2.1.1: This returns the confirmation counter.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
confirmationCounter[out] The confirmation counter.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_data()

OPGP_ERROR_STATUS GP211_get_data ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  identifier[2],
PBYTE  recvBuffer,
PDWORD  recvBufferLength 
)

GlobalPlatform2.1.1: Retrieve card data.

Retrieves a single card data object from the card identified by identifier. Some cards do not provide some data objects. Some possible identifiers are predefined. See GP211_GET_DATA_CPLC_WHOLE_CPLC and so on. For details about the coding of the response see the programmer's manual of your card. There is a convenience method get_key_information_templates() to get the key information template(s) containing key set version, key index, key type and key length of the keys.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
identifier[in] Two byte buffer with high and low order tag value for identifying card data object.
recvBuffer[out] The buffer for the card data object.
recvBufferLength[in, out] The length of the received card data object.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_data_iso7816_4()

OPGP_ERROR_STATUS GP211_get_data_iso7816_4 ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
BYTE  identifier[2],
PBYTE  recvBuffer,
PDWORD  recvBufferLength 
)

Retrieve card data according ISO/IEC 7816-4 command not within a secure channel.

This command is useful to return the Card Data with identifier 0x0066 containing the Card Recognition Data with tag 0x73 containing among others the Secure Channel Protocol and the eventual implementations. For getting the Secure Channel Protocol and Secure Channel Protocol implementation there is the convenience function get_secure_channel_protocol_details(). See also data objects identified in ISO 7816-6.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
identifier[in] Two byte buffer with high and low order tag value for identifying card data.
recvBuffer[out] The buffer for the card data.
recvBufferLength[in, out] The length of the received card data.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_delete_token_signature_data()

OPGP_ERROR_STATUS GP211_get_delete_token_signature_data ( OPGP_AID AIDs,
DWORD  AIDsLength,
PBYTE  deleteTokenSignatureData,
PDWORD  deleteTokenSignatureDataLength 
)

GlobalPlatform2.3.1: Function to retrieve the data to sign for delegated management in a Delete Token.

If you are not the Card Issuer and do not know the token verification private key send this data to the Card Issuer and obtain the signature of the data, i.e., the Delete Token. The parameters must match the parameters of a later GP211_delete_application() method.

Parameters
AIDs[in] A pointer to an array of OPGP_AID structures describing the applications and load files to delete.
AIDsLength[in] The number of OPGP_AID structures.
deleteTokenSignatureData[out] The data to sign in a Delete Token.
deleteTokenSignatureDataLength[in, out] The length of the deleteTokenSignatureData buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_diversification_data()

OPGP_ERROR_STATUS GP211_get_diversification_data ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  recvBuffer,
PDWORD  recvBufferLength 
)

GlobalPlatform2.1.1: Retrieve diversification data (tag 0xCF).

Retrieves the GlobalPlatform diversification data object with GET DATA tag CF. The returned buffer receives the value of the CF TLV, without the outer tag and length bytes.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication(), or NULL if the command is sent without secure messaging.
recvBuffer[out] The buffer for the diversification data value.
recvBufferLength[in, out] The length of the receive buffer and, on success, the number of bytes copied to recvBuffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_get_ecka_certificate()

OPGP_ERROR_STATUS GP211_get_ecka_certificate ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keyVersionNumber,
BYTE  keyIdentifier,
PBYTE  recvBuffer,
PDWORD  recvBufferLength 
)

SCP11: Retrieves the ECKA certificate store (GET DATA with tag BF21).

Retrieves the SCP11 ECKA certificate store with GET DATA tag BF21. The command data contains a Control Reference Template (A6) with the key identifier and key version number. The returned data is copied without the status word and may contain the complete certificate store TLV.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication(), or NULL if the command is sent without secure messaging.
keyVersionNumber[in] Key Version Number (KVN) of the ECKA certificate store to retrieve.
keyIdentifier[in] Key Identifier (KID) of the ECKA certificate store to retrieve.
recvBuffer[out] The buffer for the ECKA certificate store response data.
recvBufferLength[in, out] The length of the receive buffer and, on success, the number of bytes copied to recvBuffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_get_extradition_token_signature_data()

OPGP_ERROR_STATUS GP211_get_extradition_token_signature_data ( PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
PBYTE  extraditionTokenSignatureData,
PDWORD  extraditionTokenSignatureDataLength 
)

GlobalPlatform2.1.1: Function to retrieve the data to sign by the Card Issuer in an Extradition Token.

If you are not the Card Issuer and do not know the token verification private key send this data to the Card Issuer and obtain the RSA signature of the data, i.e. the Extradition Token. The parameters must match the parameters of a later GP211_install_for_extradition() method.

Parameters
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
applicationAID[in] The AID of the installed application.
applicationAIDLength[in] The length of the application instance AID.
extraditionTokenSignatureData[out] The data to sign in a Install Token.
extraditionTokenSignatureDataLength[in, out] The length of the installTokenSignatureData buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_install_token_signature_data()

OPGP_ERROR_STATUS GP211_get_install_token_signature_data ( BYTE  P1,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  executableModuleAID,
DWORD  executableModuleAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  installParameters,
DWORD  installParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installTokenSignatureData,
PDWORD  installTokenSignatureDataLength 
)

GlobalPlatform2.1.1: Function to retrieve the data to sign by the Card Issuer in an Install Token.

If you are not the Card Issuer and do not know the token verification private key send this data to the Card Issuer and obtain the RSA signature of the data, i.e. the Install Token. volatileDataSpaceLimit can be 0, if the card does not need or support this tag. The parameters must match the parameters of a later GP211_install_for_install() and GP211_install_for_make_selectable() method.

Parameters
P1[in] The parameter P1 in the APDU command.
  • 0x04 for a INSTALL [for install] command
  • 0x08 for an INSTALL [for make selectable] command
  • 0x0C for an INSTALL [for install and make selectable]
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for load].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
executableModuleAID[in] The AID of the application class in the package.
executableModuleAIDLength[in] The length of the executableModuleAID buffer.
applicationAID[in] The AID of the installed application.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See GP211_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
installParameters[in] Applet install parameters for the install() method of the application.
installParametersLength[in] The length of the installParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installTokenSignatureData[out] The data to sign in a Install Token.
installTokenSignatureDataLength[in, out] The length of the installTokenSignatureData buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_key_information_templates()

OPGP_ERROR_STATUS GP211_get_key_information_templates ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keyInformationTemplate,
GP211_KEY_INFORMATION keyInformation,
PDWORD  keyInformationLength 
)

GlobalPlatform2.1.1: Retrieves key information of keys on the card.

The card must support the optional report of key information templates.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keyInformationTemplate[in] The number of the key information template.
*keyInformation[out] A pointer to an array of GP211_KEY_INFORMATION structures.
keyInformationLength[in, out] The number of GP211_KEY_INFORMATION structures.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_load_token_signature_data()

OPGP_ERROR_STATUS GP211_get_load_token_signature_data ( PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  loadFileDataBlockHash,
DWORD  loadFileDataBlockHashLength,
DWORD  nonVolatileCodeSpaceLimit,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  loadTokenSignatureData,
PDWORD  loadTokenSignatureDataLength 
)

GlobalPlatform2.1.1: Function to retrieve the data to sign by the Card Issuer in a Load Token.

If you are not the Card Issuer and do not know the token verification private key send this data to the Card Issuer and obtain the RSA signature of the data, i.e. the Load Token. volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tags. The parameters must match the parameters of a later GP211_install_for_load() command.

Parameters
executableLoadFileAID[in] A buffer containing the Executable Load File AID.
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
loadFileDataBlockHash[in] The Load File Data Block Hash. The same calculated as in GP211_install_for_load().
loadFileDataBlockHashLength[in] The length of the loadFileDataBlockHash buffer.
nonVolatileCodeSpaceLimit[in] The minimum space required to store the application code.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
loadTokenSignatureData[out] The data to sign in a Load Token.
loadTokenSignatureDataLength[in, out] The length of the loadTokenSignatureData buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_registry_update_token_signature_data()

OPGP_ERROR_STATUS GP211_get_registry_update_token_signature_data ( PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
PBYTE  registryUpdateParameters,
DWORD  registryUpdateParametersLength,
PBYTE  tokenSignatureData,
PDWORD  tokenSignatureDataLength 
)

GlobalPlatform2.3.1: Function to retrieve the data to sign for delegated management in a Registry Update Token.

If you are not the Card Issuer and do not know the token verification private key send this data to the Card Issuer and obtain the signature of the data, i.e., the Registry Update Token. The parameters must match the parameters of a later GP211_install_for_registry_update() method.

Parameters
securityDomainAID[in] A buffer containing the target Security Domain AID.
securityDomainAIDLength[in] The length of the target Security Domain AID.
applicationAID[in] The AID of the application.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges.
registryUpdateParameters[in] The Registry Update Parameters.
registryUpdateParametersLength[in] The length of the Registry Update Parameters.
tokenSignatureData[out] The data to sign in a Registry Update Token.
tokenSignatureDataLength[in, out] The length of the tokenSignatureData buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_secure_channel_protocol_details()

OPGP_ERROR_STATUS GP211_get_secure_channel_protocol_details ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE secureChannelProtocol,
BYTE secureChannelProtocolImpl 
)

GlobalPlatform2.1.1: This returns the Secure Channel Protocol and the Secure Channel Protocol implementation.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
*secureChannelProtocol[out] A pointer to the Secure Channel Protocol to use.
*secureChannelProtocolImpl[out] A pointer to the implementation of the Secure Channel Protocol.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_sequence_counter()

OPGP_ERROR_STATUS GP211_get_sequence_counter ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
DWORD sequenceCounter 
)

GlobalPlatform2.1.1: This returns the current Sequence Counter.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
sequenceCounter[out] The sequence counter.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_status()

OPGP_ERROR_STATUS GP211_get_status ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  cardElement,
BYTE  format,
GP211_APPLICATION_DATA applData,
GP211_EXECUTABLE_MODULES_DATA executableData,
PDWORD  dataLength 
)

GlobalPlatform2.1.1: Gets the life cycle status of Applications, the Issuer Security Domains, Security Domains and Executable Load Files and their privileges or information about Executable Modules of the Executable Load Files.

It depends on the card element to retrieve if an array of GP211_APPLICATION_DATA structures or an array of GP211_EXECUTABLE_MODULES_DATA structures must be passed to this function. For the card element GP211_EXECUTABLE_MODULES_DATA executableData must not be NULL, else applData must not be NULL.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
cardElement[in] Identifier to retrieve data for Load Files, Applications or the Card Manager.
format[in] The GET STATUS output format. Newer cards might not support the legacy format. See GP211_STATUS_APPLICATIONS and related.
*applData[out] The GP211_APPLICATION_DATA structure.
*executableData[out] The GP211_APPLICATION_DATA structure.
dataLength[in, out] The number of GP211_APPLICATION_DATA or GP211_EXECUTABLE_MODULES_DATA passed and returned.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_get_supported_ca_identifiers()

OPGP_ERROR_STATUS GP211_get_supported_ca_identifiers ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BOOL  returnCaKlccIdentifiers,
PBYTE  recvBuffer,
PDWORD  recvBufferLength 
)

SCP11: Retrieves supported CA identifiers (GET DATA with tag FF33 or FF34).

Retrieves SCP11 supported CA identifiers with GET DATA tags FF33 (CA-KLOC) and FF34 (CA-KLCC).

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication(), or NULL if the command is sent without secure messaging.
returnCaKlccIdentifiers[in] FALSE for FF33 (CA-KLOC), TRUE for FF34 (CA-KLCC).
recvBuffer[out] The buffer for the response data.
recvBufferLength[in, out] The length of recvBuffer and, on success, the number of bytes copied.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_init_implicit_secure_channel()

OPGP_ERROR_STATUS GP211_init_implicit_secure_channel ( PBYTE  AID,
DWORD  AIDLength,
BYTE  baseKey[16],
BYTE  S_ENC[16],
BYTE  S_MAC[16],
BYTE  DEK[16],
BYTE  secureChannelProtocolImpl,
BYTE  sequenceCounter[2],
GP211_SECURITY_INFO secInfo 
)

GlobalPlatform2.1.1: Inits a Secure Channel implicitly.

This is only supported in SCP02. It depends on the supported protocol implementation by the card what keys must be passed as parameters. baseKey must be NULL if the protocol uses 3 Secure Channel Keys (Secure Channel Encryption Key, Secure Channel Message Authentication Code Key and Data Encryption Key) and vice versa. Details about the supported Secure Channel Protocol and its implementation can be obtained by a call to the function GP211_get_secure_channel_protocol_details(). New cards usually use the VISA default key for all DES keys. See OPGP_VISA_DEFAULT_KEY. The current Sequence Counter can be obtained with a call to GP211_get_sequence_counter(). SCP02 is implicitly set and the security level is set to C-MAC only.

Parameters
AIDThe AID needed for the calculation of the ICV.
AIDLengthThe length of the AID buffer.
baseKey[in] Secure Channel base key.
S_ENC[in] Secure Channel Encryption Key.
S_MAC[in] Secure Channel Message Authentication Code Key.
DEK[in] Data Encryption Key.
secureChannelProtocolImpl[in] The Secure Channel Protocol Implementation.
sequenceCounter[in] The sequence counter.
*secInfo[out] The returned GP211_SECURITY_INFO structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_install_for_extradition()

OPGP_ERROR_STATUS GP211_install_for_extradition ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
PBYTE  extraditionToken,
DWORD  extraditionTokenLength,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

GlobalPlatform2.1.1: Associates an application with another Security Domain.

In the case of delegated management an Extradition Token authorizing the INSTALL [for extradition] must be included. Otherwise extraditionToken must be NULL. See GP211_calculate_extradition_token().

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
securityDomainAID[in] A buffer containing the target Security Domain AID.
securityDomainAIDLength[in] The length of the target Security Domain AID.
applicationAID[in] The AID of the installed application to be moved.
applicationAIDLength[in] The length of the application instance AID to be moved.
extraditionToken[in] The Extradition Token. This is an assymetric (e.g., ECC or RSA) Signature.
extraditionTokenLength[in] The length of the extraditionToken buffer.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_install_for_install()

OPGP_ERROR_STATUS GP211_install_for_install ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  executableModuleAID,
DWORD  executableModuleAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  installParameters,
DWORD  installParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installToken,
DWORD  installTokenLength,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

GlobalPlatform2.1.1: Installs an application on the card.

In the case of delegated management an Install Token authorizing the INSTALL [for install] must be included. Otherwise installToken must be NULL. See GP211_calculate_install_token(). volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tag. For Security domains look in your manual what parameters are necessary. If the tag for application install parameters is mandatory for your card, but you have no install parameters for the install() method of the application anyway you have to use at least a dummy parameter. If executableModuleAID is NULL and executableModuleAIDLength is 0 applicationAID is assumed for executableModuleAID.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for install].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
executableModuleAID[in] The AID of the application class in the package.
executableModuleAIDLength[in] The length of the executableModuleAID buffer.
applicationAID[in] The AID of the installed application.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See GP211_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
installParameters[in] Applet install parameters for the install() method of the application.
installParametersLength[in] The length of the installParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installToken[in] The Install Token. This is an assymetric (e.g., ECC or RSA) Signature.
installTokenLength[in] The length of the installToken buffer.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_install_for_install_and_make_selectable()

OPGP_ERROR_STATUS GP211_install_for_install_and_make_selectable ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  executableModuleAID,
DWORD  executableModuleAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  installParameters,
DWORD  installParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installToken,
DWORD  installTokenLength,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

GlobalPlatform2.1.1: Installs and makes an installed application selectable.

In the case of delegated management an Install Token authorizing the INSTALL [for install and make selectable] must be included. Otherwise installToken must be NULL. See GP211_calculate_install_token(). volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tag. For Security domains look in your manual what parameters are necessary. If the tag for application install parameters is mandatory for your card, but you have no install parameters for the install() method of the application anyway you have to use at least a dummy parameter. If executableModuleAID is NULL and executableModuleAIDLength is 0 applicationAID is assumed for executableModuleAID.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for install].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
executableModuleAID[in] The AID of the application class in the package.
executableModuleAIDLength[in] The length of the executableModuleAID buffer.
applicationAID[in] The AID of the installed application.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See GP211_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
installParameters[in] Applet install parameters for the install() method of the application.
installParametersLength[in] The length of the installParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installToken[in] The Install Token. This is an assymetric (e.g., ECC or RSA) Signature.
installTokenLength[in] The length of the installToken buffer.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_install_for_load()

OPGP_ERROR_STATUS GP211_install_for_load ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  loadFileDataBlockHash,
DWORD  loadFileDataBlockHashLength,
PBYTE  loadToken,
DWORD  loadTokenLength,
DWORD  nonVolatileCodeSpaceLimit,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit 
)

GlobalPlatform2.1.1: Prepares the card for loading an application.

The function assumes that the Issuer Security Domain or Security Domain uses an optional Load File Data Block Hash using the SHA-1 message digest algorithm. The loadFileDataBlockHash can be calculated using GP211_calculate_load_file_data_block_hash() or must be NULL, if the card does not need or support a Load File DAP in this situation, e.g. if you want to load a Executable Load File to the Card Manager Security Domain. In the case of delegated management a Load Token authorizing the INSTALL [for load] must be included. Otherwise loadToken must be NULL. See GP211_calculate_load_token(). The term Executable Load File is equivalent to the GlobalPlatform term Load File Data Block. volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tags.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for load].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
securityDomainAID[in] A buffer containing the AID of the intended associated Security Domain.
securityDomainAIDLength[in] The length of the Security Domain AID.
loadFileDataBlockHash[in] The Load File Data Block Hash of the Executable Load File to INSTALL [for load].
loadFileDataBlockHashLength[in] The length of the loadFileDataBlockHash buffer.
loadToken[in] The Load Token. This is an assymetric (e.g., ECC or RSA) Signature.
loadTokenLength[in] The length of the loadToken buffer.
nonVolatileCodeSpaceLimit[in] The minimum amount of space that must be available to store the package.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_install_for_make_selectable()

OPGP_ERROR_STATUS GP211_install_for_make_selectable ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
PBYTE  installToken,
DWORD  installTokenLength,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

GlobalPlatform2.1.1: Makes an installed application selectable.

In the case of delegated management an Install Token authorizing the INSTALL [for make selectable] must be included. Otherwise installToken must be NULL. For Security domains look in your manual what parameters are necessary.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
applicationAID[in] The AID of the installed application or security domain.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See GP211_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
installToken[in] The Install Token. This is an assymetric (e.g., ECC or RSA) Signature.
installTokenLength[in] The length of the installToken buffer.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_install_for_personalization()

OPGP_ERROR_STATUS GP211_install_for_personalization ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  applicationAID,
DWORD  applicationAIDLength 
)

GlobalPlatform2.1.1: Informs a Security Domain that a associated application will retrieve personalization data.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
applicationAID[in] The AID of the installed application.
applicationAIDLength[in] The length of the application instance AID.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_install_for_registry_update()

OPGP_ERROR_STATUS GP211_install_for_registry_update ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
DWORD  applicationPrivileges,
PBYTE  registryUpdateParameters,
DWORD  registryUpdateParametersLength,
PBYTE  registryUpdateToken,
DWORD  registryUpdateTokenLength,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

GlobalPlatform2.3.1: Updates the registry of an application or Security Domain.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
securityDomainAID[in] A buffer containing the target Security Domain AID.
securityDomainAIDLength[in] The length of the target Security Domain AID.
applicationAID[in] The AID of the application.
applicationAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges.
registryUpdateParameters[in] The Registry Update Parameters.
registryUpdateParametersLength[in] The length of the Registry Update Parameters.
registryUpdateToken[in] The Registry Update Token. This is an assymetric (e.g., ECC or RSA) Signature.
registryUpdateTokenLength[in] The length of the Registry Update Token.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_load()

OPGP_ERROR_STATUS GP211_load ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
GP211_DAP_BLOCK loadFileDataBlockSignature,
DWORD  loadFileDataBlockSignatureLength,
OPGP_STRING  executableLoadFileName,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable,
OPGP_PROGRESS_CALLBACK callback 
)

GlobalPlatform2.1.1: Loads a Executable Load File (containing an application) to the card.

An GP211_install_for_load() must precede. The Load File Data Block Signature(s) must be the same block(s) and in the same order like in GP211_calculate_load_file_data_block_hash(). If no Load File Data Block Signatures are necessary the loadFileDataBlockSignature must be NULL and the loadFileDataBlockSignatureLength 0.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
*loadFileDataBlockSignature[in] A pointer to GP211_DAP_BLOCK structure(s).
loadFileDataBlockSignatureLength[in] The number of GP211_DAP_BLOCK structure(s).
executableLoadFileName[in] The name of the CAP or IJC file (Executable Load File) to load.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data. Can be validated with validate_load_receipt().
receiptDataAvailable[out] 0 if no receiptData is available.
*callback[in] An optional callback for measuring the progress. Can be NULL if not needed.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_load_from_buffer()

OPGP_ERROR_STATUS GP211_load_from_buffer ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
GP211_DAP_BLOCK loadFileDataBlockSignature,
DWORD  loadFileDataBlockSignatureLength,
PBYTE  loadFileBuf,
DWORD  loadFileBufSize,
GP211_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable,
OPGP_PROGRESS_CALLBACK callback 
)

GlobalPlatform2.1.1: Loads a Executable Load File (containing an application) from a buffer to the card.

An GP211_install_for_load() must precede. The Load File Data Block Signature(s) must be the same block(s) and in the same order like in calculate_load_file_data_block_hash(). If no Load File Data Block Signatures are necessary the loadFileDataBlockSignature must be NULL and the loadFileDataBlockSignatureLength 0.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
*loadFileDataBlockSignature[in] A pointer to GP211_DAP_BLOCK structure(s).
loadFileDataBlockSignatureLength[in] The number of GP211_DAP_BLOCK structure(s).
loadFileBuf[in] buffer with the contents of a Executable Load File.
loadFileBufSize[in] size of loadFileBuf.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data. Can be validated with validate_load_receipt().
receiptDataAvailable[out] 0 if no receiptData is available.
*callback[in] An optional callback for measuring the progress. Can be NULL if not needed.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_mutual_authentication()

OPGP_ERROR_STATUS GP211_mutual_authentication ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
PBYTE  baseKeyOrStaticOcePrivateKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK,
DWORD  keyLength,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  secureChannelProtocol,
BYTE  secureChannelProtocolImpl,
BYTE  securityLevel,
BYTE  derivationMethod,
PBYTE  certOceEcka,
DWORD  certOceEckaLength,
PBYTE  sdPublicKeyOverride,
DWORD  sdPublicKeyOverrideLength,
OPGP_STRING  sdPublicKeyFileName,
GP211_SECURITY_INFO secInfo 
)

GlobalPlatform2.1.1: Mutual authentication.

For SCP01, SCP02 and SCP03 the baseKeyOrStaticOcePrivateKey parameter is the Secure Channel base key, or the master key used by the selected key derivation method. Pass it as NULL when the selected protocol implementation uses separate Secure Channel keys via S_ENC, S_MAC and DEK.

For SCP11a the same parameter is the raw static OCE ECKA private key (SK.OCE.ECKA) used with the card SD ECKA public key from CERT.SD.ECKA during key agreement. The SCP11a private key length is determined from the card certificate key parameter reference; keyLength remains the requested AES session key length (16, 24 or 32 bytes). S_ENC, S_MAC and DEK are not used for SCP11a.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
baseKeyOrStaticOcePrivateKey[in] SCP01/SCP02/SCP03 base or master key, or SCP11a static OCE ECKA private key.
S_ENC[in] Secure Channel Encryption Key for SCP01/SCP02/SCP03 implementations with separate static keys.
S_MAC[in] Secure Channel Message Authentication Code Key for SCP01/SCP02/SCP03 implementations with separate static keys.
DEK[in] Data Encryption Key for SCP01/SCP02/SCP03 implementations with separate static keys.
keyLength[in] Symmetric key length. 16, 24 or 32 bytes.
keySetVersion[in] The key set version on the card to use for mutual authentication.
keyIndex[in] The key index in the key set version on the card to use for mutual authentication.
secureChannelProtocol[in] The Secure Channel Protocol. Use GP211_SCP11 explicitly for SCP11a. Passing 0 only auto-detects SCP01/SCP02/SCP03 via INITIALIZE UPDATE; callers may use GP211_get_secure_channel_protocol_details() before authentication for card-recognition based discovery.
secureChannelProtocolImpl[in] The Secure Channel Protocol implementation. For SCP11a this is the SCP parameter byte; the SCP11a variant bits are applied by this function.
securityLevel[in] The requested security level. See GP211_SCP01_SECURITY_LEVEL_C_DEC_C_MAC and others.
derivationMethod[in] The derivation method to use. See OPGP_DERIVATION_METHOD_VISA2.
certOceEcka[in] Optional SCP11 certificate chain data to submit before mutual authentication. The data must contain one or more 7F21 or X.509 DER certificates, optionally wrapped in BF21, and must end with CERT.OCE.ECKA.
certOceEckaLength[in] Length of certOceEcka.
sdPublicKeyOverride[in] Optional SCP11 PK.SD.ECKA public key as raw uncompressed EC point or B0-wrapped point.
sdPublicKeyOverrideLength[in] Length of sdPublicKeyOverride.
sdPublicKeyFileName[in] Optional PEM file containing PK.SD.ECKA. If set, this takes precedence over sdPublicKeyOverride.
secInfo[out] The returned GP211_SECURITY_INFO structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_parse_card_capability_information()

OPGP_ERROR_STATUS GP211_parse_card_capability_information ( const BYTE data,
DWORD  dataLength,
GP211_CARD_CAPABILITY_INFORMATION cardCapabilityInfo 
)

Parses the card capability information response.

Parses a GlobalPlatform Card Capability Information response. The input must contain tag 67 and may include supported SCP information, privilege masks, algorithm identifiers, key parameter references and policy flags.

Parameters
data[in] The card capability information response.
dataLength[in] The length of data.
cardCapabilityInfo[out] The parsed card capability information.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_parse_card_recognition_data()

OPGP_ERROR_STATUS GP211_parse_card_recognition_data ( const BYTE data,
DWORD  dataLength,
GP211_CARD_RECOGNITION_DATA cardData 
)

Parses the card recognition data response.

Parses a GlobalPlatform Card Recognition Data response. The parser accepts the GET DATA card data object and walks to the tag 73 Card Recognition Data template, then extracts the card management version, supported Secure Channel Protocol OIDs and optional card details.

Parameters
data[in] The card recognition data response.
dataLength[in] The length of data.
cardData[out] The parsed card recognition data.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_parse_scp11_certificate()

OPGP_ERROR_STATUS GP211_parse_scp11_certificate ( PBYTE  certificateData,
DWORD  certificateDataLength,
GP211_SCP11_CERTIFICATE certificate 
)

SCP11: Parses a certificate encoded according to table 6-12.

Parses an SCP11 certificate encoded according to table 6-12. The input must be a complete CERT.KA-KLOC.ECDSA or CERT.OCE.ECKA object encoded as tag 7F21.

Parameters
certificateData[in] The encoded SCP11 certificate.
certificateDataLength[in] The length of certificateData.
certificate[out] The parsed certificate fields.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_perform_security_operation()

OPGP_ERROR_STATUS GP211_perform_security_operation ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  caKlocKeyVersionNumber,
BYTE  caKlocKeyIdentifier,
PBYTE  certificateData,
DWORD  certificateDataLength,
BOOL  moreCertificatesExpected 
)

SCP11: Submits CERT.OCE.ECKA (PERFORM SECURITY OPERATION, INS 2A).

Submits SCP11 certificate data with PERFORM SECURITY OPERATION. The input may contain a single certificate, consecutive certificates, or a BF21 wrapper containing those certificates. For certificate lists, P2.b8 is derived from each certificate's position in the list. For a single certificate, moreCertificatesExpected controls P2.b8.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication(), or NULL if the command is sent without secure messaging.
caKlocKeyVersionNumber[in] CA-KLOC Key Version Number (KVN).
caKlocKeyIdentifier[in] CA-KLOC Key Identifier (KID).
certificateData[in] One or more 7F21 or 30 certificates, optionally wrapped in BF21.
certificateDataLength[in] The length of certificateData.
moreCertificatesExpected[in] TRUE if another certificate follows this single-certificate input, otherwise FALSE. Ignored for multi-certificate inputs.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_perform_security_operation_certificate_chain()

OPGP_ERROR_STATUS GP211_perform_security_operation_certificate_chain ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  caKlocKeyVersionNumber,
BYTE  caKlocKeyIdentifier,
PBYTE  certificateChainData,
DWORD  certificateChainDataLength 
)

SCP11: Submits a certificate chain ending in CERT.OCE.ECKA with PERFORM SECURITY OPERATION.

Submits an SCP11 certificate chain with PERFORM SECURITY OPERATION. The input must contain either one or more consecutive certificates, or a BF21 wrapper containing those certificates. Supported certificate formats are legacy GP (tag 7F21) and X.509 DER (tag 30). The chain must contain exactly one format; mixed chains are rejected. For legacy GP certificates, key usage is validated locally (intermediate certificates must be digital signature verification; the final certificate must be key agreement). X.509 chains are ordered from issuer to subject and a self-issued trust anchor is omitted. Local X.509 key usage parsing is not performed. Each certificate is submitted separately; P2.b8 is set for every intermediate certificate and cleared for the final certificate.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication(), or NULL if the command is sent without secure messaging.
caKlocKeyVersionNumber[in] CA-KLOC Key Version Number (KVN) used for verifying the first certificate.
caKlocKeyIdentifier[in] CA-KLOC Key Identifier (KID) used for verifying the first certificate.
certificateChainData[in] One or more 7F21 or 30 certificates, optionally wrapped in BF21.
certificateChainDataLength[in] The length of certificateChainData.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_pin_change()

OPGP_ERROR_STATUS GP211_pin_change ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  tryLimit,
PBYTE  newPIN,
DWORD  newPINLength 
)

GlobalPlatform2.1.1: Changes or unblocks the global PIN.

The single numbers of the new PIN are encoded as single BYTEs in the newPIN buffer. The tryLimit must be in the range of 0x03 and x0A. The PIN must comprise at least 6 numbers and not exceeding 12 numbers. To unblock the PIN use tryLimit with a value of 0x00. In this case newPIN buffer and newPINLength are ignored.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
tryLimit[in] The try limit for the PIN.
newPIN[in] The new PIN.
newPINLength[in] The length of the new PIN.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_put_3des_key()

OPGP_ERROR_STATUS GP211_put_3des_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
BYTE  _3DESKey[16] 
)

GlobalPlatform2.1.1: replaces a single 3DES key in a key set or adds a new 3DES key.

A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version a new key belongs to. This can be the same key version or a new not existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The new key set version.
_3DESKey[in] The new 3DES key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_put_aes_key()

OPGP_ERROR_STATUS GP211_put_aes_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
BYTE  aesKey[32],
DWORD  keyLength 
)

GlobalPlatform2.1.1: replaces a single AES key in a key set or adds a new AES key.

A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version a new key belongs to. This can be the same key version or a new not existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The new key set version.
aesKey[in] The new AES key.
keyLength[in] The key length. 16, 24 or 32 bytes.

◆ GP211_put_asymmetric_keys()

OPGP_ERROR_STATUS GP211_put_asymmetric_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
BYTE  keyType 
)

GlobalPlatform2.3.1: replaces a single public asymmetric key in a key set or adds a new public asymmetric key.

A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version a new key belongs to. This can be the same key version or a new not existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The new key set version.
PEMKeyFileName[in] A PEM file name with the public asymmetric key.
*passPhrase[in] The passphrase. Must be an ASCII string.
keyType[in] The asymmetric key type (RSA or ECC).
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_put_dap_keys()

OPGP_ERROR_STATUS GP211_put_dap_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
BYTE  keyType,
BYTE  key[32],
DWORD  keyLength 
)

GlobalPlatform2.3.1: Adds a DAP verification key set (asymmetric or symmetric).

Adds or replaces a DAP Verification Key. RSA and ECC DAP keys are loaded as asymmetric public keys at key index 0x01; AES and 3DES DAP keys are loaded as symmetric keys.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] Existing key set version, or 0x00 to add a new key.
newKeySetVersion[in] The key set version assigned to the new key.
PEMKeyFileName[in] A PEM file name with the public asymmetric DAP key.
passPhrase[in] The passphrase, or NULL if not needed.
keyType[in] The DAP key type. See GP211_KEY_TYPE_RSA, GP211_KEY_TYPE_ECC, GP211_KEY_TYPE_AES and GP211_KEY_TYPE_3DES.
key[in] The symmetric DAP key when keyType is AES or 3DES.
keyLength[in] The symmetric DAP key length in bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_put_data()

OPGP_ERROR_STATUS GP211_put_data ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  identifier[2],
PBYTE  dataObject,
DWORD  dataObjectLength 
)

GlobalPlatform2.1.1: Put card data.

Puts a single card data object identified by identifier. Some cards do not provide some data objects. Some possible identifiers are predefined. See GP211_GET_DATA_CPLC_WHOLE_CPLC. For details about the coding of the dataObject see the programmer's manual of your card.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
identifier[in] Two byte buffer with high and low order tag value for identifying card data object.
dataObject[in] The coded data object.
dataObjectLength[in] The length of the data object.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_put_delegated_management_receipt_keys()

OPGP_ERROR_STATUS GP211_put_delegated_management_receipt_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  newKeySetVersion,
BYTE  receiptKey[32],
DWORD  keyLength,
BYTE  receiptKeyType 
)

GlobalPlatform2.1.1: Adds a receipt generation key set for Delegated Management.

Adds or replaces a Delegated Management Receipt Key.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] Existing key set version, or 0x00 to add a new key.
newKeySetVersion[in] The key set version assigned to the new key.
receiptKey[in] The receipt key.
keyLength[in] The receipt key length in bytes.
receiptKeyType[in] The receipt key type. See GP211_KEY_TYPE_AES and GP211_KEY_TYPE_3DES.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_put_delegated_management_token_keys()

OPGP_ERROR_STATUS GP211_put_delegated_management_token_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
BYTE  tokenKeyType 
)

GlobalPlatform2.1.1: Adds a token verification key set for Delegated Management.

Adds or replaces a Delegated Management Token Verification Key. RSA and ECC token keys are loaded as asymmetric public keys at key index 0x01.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] Existing key set version, or 0x00 to add a new key.
newKeySetVersion[in] The key set version assigned to the new key.
PEMKeyFileName[in] A PEM file name with the public token key.
passPhrase[in] The passphrase, or NULL if not needed.
tokenKeyType[in] The token key type. See GP211_KEY_TYPE_RSA and GP211_KEY_TYPE_ECC.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_put_ecc_key()

OPGP_ERROR_STATUS GP211_put_ecc_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: replaces a single public ECC key in a key set or adds a new public ECC key.

A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version a new key belongs to. This can be the same key version or a new not existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The new key set version.
PEMKeyFileName[in] A PEM file name with the public ECC key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_put_ecc_key_with_curve_parameter_reference()

OPGP_ERROR_STATUS GP211_put_ecc_key_with_curve_parameter_reference ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: replaces or adds a public ECC key using a curve parameter reference.

Adds or replaces an ECC public key using a curve parameter reference instead of embedding the curve parameters.

◆ GP211_put_ecc_private_key_with_curve_parameter_reference()

OPGP_ERROR_STATUS GP211_put_ecc_private_key_with_curve_parameter_reference ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
BYTE  privateKey[32],
DWORD  privateKeyLength 
)

GlobalPlatform2.3.1: replaces or adds a raw private ECC key using a curve parameter reference.

Adds or replaces an ECC private key using a curve parameter reference.

◆ GP211_put_rsa_key()

OPGP_ERROR_STATUS GP211_put_rsa_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.1.1: replaces a single public RSA key in a key set or adds a new public RSA key.

Adds or replaces an RSA public key in a key set. A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] Existing key set version, or 0x00 to add a new key.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The key set version assigned to the new key.
PEMKeyFileName[in] A PEM file name with the public RSA key.
passPhrase[in] The passphrase, or NULL if not needed.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_put_secure_channel_keys()

OPGP_ERROR_STATUS GP211_put_secure_channel_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  newKeySetVersion,
PBYTE  newBaseKey,
PBYTE  newS_ENC,
PBYTE  newS_MAC,
PBYTE  newDEK,
DWORD  keyLength,
BYTE  keyType 
)

GlobalPlatform2.1.1: replaces or adds a secure channel key set consisting of S-ENC, S-MAC and DEK.

A keySetVersion value of 0x00 adds a new secure channel key set. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version the new secure channel keys belongs to. This can be the same key version or a new not existing key set version. It depends on the supported protocol implementation by the card what keys must be passed as parameters. baseKey must be NULL if the protocol uses 3 Secure Channel Keys (Secure Channel Encryption Key, Secure Channel Message Authentication Code Key and Data Encryption Key) and vice versa. Details about the supported Secure Channel Protocol and its implementation can be obtained by a call to the function GP211_get_secure_channel_protocol_details(). Sometimes a key derivation of the put keys might be necessary so it is necessary to call GP211_EMV_CPS11_derive_keys() or any other derivation function. If this is the newBaseKey must be NULL and the derived keys are passed as the 3 Secure Channel Keys.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] An existing key set version.
newKeySetVersion[in] The new key set version.
newBaseKey[in] The new Secure Channel base key.
newS_ENC[in] The new S-ENC key.
newS_MAC[in] The new S-MAC key.
newDEK[in] The new DEK.
keyLength[in] The key length. 16, 24 or 32 bytes.
keyType[in] The key type or 0 for implicit selection based on the SCP. See GP211_KEY_TYPE_AES.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_put_symmetric_key()

OPGP_ERROR_STATUS GP211_put_symmetric_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
BYTE  key[32],
DWORD  keyLength,
BYTE  keyType 
)

GlobalPlatform2.1.1: replaces a single symmetric key in a key set or adds a new key.

Adds or replaces a symmetric key in a key set. A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keySetVersion[in] Existing key set version, or 0x00 to add a new key.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The key set version assigned to the new key.
key[in] The new symmetric key.
keyLength[in] The key length in bytes.
keyType[in] The key type. See GP211_KEY_TYPE_AES and GP211_KEY_TYPE_3DES.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_send_APDU()

OPGP_ERROR_STATUS GP211_send_APDU ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  capdu,
DWORD  capduLength,
PBYTE  rapdu,
PDWORD  rapduLength 
)

Sends an application protocol data unit.

The secInfo pointer can also be null and so this function can be used for arbitrary cards.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
capdu[in] The command APDU.
capduLength[in] The length of the command APDU.
rapdu[out] The response APDU.
rapduLength[in, out] The length of the response APDU.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_set_status()

OPGP_ERROR_STATUS GP211_set_status ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  statusType,
PBYTE  AID,
DWORD  AIDLength,
BYTE  lifeCycleState 
)

GlobalPlatform2.1.1: Sets the life cycle status of Applications, Security Domains or the Card Manager.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
statusType[in] Status type. See GP211_STATUS_TYPE_APPLICATIONS.
AID[in] The AID.
AIDLength[in] The length of the AID.
lifeCycleState[in] The new life cycle state.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_store_data()

OPGP_ERROR_STATUS GP211_store_data ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  encryptionFlags,
BYTE  formatFlags,
BOOL  responseDataExpected,
PBYTE  data,
DWORD  dataLength 
)

GlobalPlatform2.1.1: The STORE DATA command is used to transfer data to an Application or the Security Domain processing the command.

If STORE DATA is used for personalizing an application, a GP211_install_for_personalization() must be called first.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
encryptionFlags[in] Flag defining the encryption settings. See STORE_DATA_ENCRYPTION_NO_INFORMATION.
formatFlags[in] Flag defining the format settings. See STORE_DATA_FORMAT_DGI.
responseDataExpected[in] TRUE if response data is expected. In this case a case 4 APDU is used. FALSE to use a case 3 APDU.
*data[in] Data to send to application or Security Domain.
dataLength[in] The length of the data buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_store_data_ca_kloc_kid_kvn()

OPGP_ERROR_STATUS GP211_store_data_ca_kloc_kid_kvn ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  caKlocIdentifier,
DWORD  caKlocIdentifierLength,
BYTE  keyIdentifier,
BYTE  keyVersionNumber 
)

SCP11: STORE DATA for a CA-KLOC Identifier to PK.CA-KLOC.ECDSA mapping (section 6.9).

Stores an SCP11 CA-KLOC Identifier to KID/KVN mapping using STORE DATA. The CA-KLOC Identifier is encoded in tag 42 and the key reference in tag 83, both inside a Control Reference Template.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
caKlocIdentifier[in] The CA-KLOC Identifier value.
caKlocIdentifierLength[in] The length of caKlocIdentifier.
keyIdentifier[in] Key Identifier (KID) to map.
keyVersionNumber[in] Key Version Number (KVN) to map.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_store_data_ecka_certificate()

OPGP_ERROR_STATUS GP211_store_data_ecka_certificate ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keyVersionNumber,
BYTE  keyIdentifier,
OPGP_STRING  certificateStoreFileName 
)

SCP11: STORE DATA for the ECKA certificate store (section 6.7).

Stores an SCP11 ECKA certificate store using STORE DATA. The input file must contain either DER or PEM encoded certificate data. For PEM input, CERTIFICATE blocks are converted to DER first. The resulting data must contain either a complete BF21 certificate store TLV or a certificate list value for BF21 according to section 7.2 table 7-4. The certificate list must contain homogeneous certificates in either legacy GP format (7F21) or X.509 DER format (30), but not both. The command data also includes a Control Reference Template for KID/KVN.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keyVersionNumber[in] Key Version Number (KVN) assigned to the certificate store.
keyIdentifier[in] Key Identifier (KID) assigned to the certificate store.
certificateStoreFileName[in] File name of the encoded SCP11 certificate store.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_store_data_whitelist()

OPGP_ERROR_STATUS GP211_store_data_whitelist ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  keyVersionNumber,
BYTE  keyIdentifier,
BOOL  whitelistCounterPresent,
USHORT  whitelistCounter,
PBYTE certificateSerialNumbers,
PDWORD  certificateSerialNumberLengths,
DWORD  certificateSerialNumberCount 
)

SCP11: STORE DATA for a whitelist linked to a PK.CA-KLOC.ECDSA (section 6.8).

Stores an SCP11 whitelist using STORE DATA. The whitelist is linked to the KID/KVN in the Control Reference Template and encoded in tag 70. Each Certificate Serial Number is encoded as a tag 93 TLV inside tag 70. If present, the whitelist counter is encoded in tag 92.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keyVersionNumber[in] Key Version Number (KVN) of the related CA-KLOC key.
keyIdentifier[in] Key Identifier (KID) of the related CA-KLOC key.
whitelistCounterPresent[in] TRUE to include the whitelist counter.
whitelistCounter[in] The whitelist counter value when whitelistCounterPresent is TRUE.
certificateSerialNumbers[in] Array of Certificate Serial Number byte arrays. May be NULL when certificateSerialNumberCount is 0.
certificateSerialNumberLengths[in] Lengths of the Certificate Serial Number byte arrays. Each length must be 1..16. May be NULL when certificateSerialNumberCount is 0.
certificateSerialNumberCount[in] Number of Certificate Serial Numbers. Use 0 to remove the whitelist.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ GP211_store_secure_channel_keys()

OPGP_ERROR_STATUS GP211_store_secure_channel_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  AID,
DWORD  AIDLength,
BYTE  keyType,
PBYTE  baseKey,
PBYTE  newS_ENC,
PBYTE  newS_MAC,
PBYTE  newDEK,
DWORD  keyLength,
BYTE  keySetVersion,
BYTE  keyAccessCondition 
)

GlobalPlatform2.3.1: STORE DATA command for storing secure channel keys using the symmetric key format.

Stores secure channel keys using STORE DATA command with symmetric key format according to GlobalPlatform v2.3.1.49 section 11.11.4.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
AID[in] The AID of the Security Domain.
AIDLength[in] The length of the AID.
keyType[in] The key type. See GP211_KEY_TYPE_AES.
baseKey[in] The base key (optional, can be NULL).
newS_ENC[in] The new S-ENC key.
newS_MAC[in] The new S-MAC key.
newDEK[in] The new DEK key.
keyLength[in] The key length in bytes.
keySetVersion[in] The key set version.
keyAccessCondition[in] The key access condition. See GP211_KEY_ACCESS_SD_AND_APPS.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_validate_delete_receipt()

OPGP_ERROR_STATUS GP211_validate_delete_receipt ( PBYTE  receiptKey,
DWORD  keyLength,
GP211_RECEIPT_DATA  receiptData,
PBYTE  AID,
DWORD  AIDLength,
BYTE  receiptKeyType,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: Validates a Delete Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys.

Validates a GlobalPlatform 2.3.1 Delete Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) keys.

◆ GP211_validate_extradition_receipt()

OPGP_ERROR_STATUS GP211_validate_extradition_receipt ( PBYTE  receiptKey,
DWORD  keyLength,
GP211_RECEIPT_DATA  receiptData,
PBYTE  oldSecurityDomainAID,
DWORD  oldSecurityDomainAIDLength,
PBYTE  newSecurityDomainAID,
DWORD  newSecurityDomainAIDLength,
PBYTE  applicationOrExecutableLoadFileAID,
DWORD  applicationOrExecutableLoadFileAIDLength,
BYTE  receiptKeyType,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: Validates an Extradition Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys.

Validates a GlobalPlatform 2.3.1 Extradition Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) keys.

◆ GP211_validate_install_receipt()

OPGP_ERROR_STATUS GP211_validate_install_receipt ( PBYTE  receiptKey,
DWORD  keyLength,
GP211_RECEIPT_DATA  receiptData,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
BYTE  receiptKeyType,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: Validates an Install Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys.

Validates a GlobalPlatform 2.3.1 Install Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) keys.

◆ GP211_validate_load_receipt()

OPGP_ERROR_STATUS GP211_validate_load_receipt ( PBYTE  receiptKey,
DWORD  keyLength,
GP211_RECEIPT_DATA  receiptData,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
BYTE  receiptKeyType,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: Validates a Load Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys.

Validates a GlobalPlatform 2.3.1 Load Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) keys.

◆ GP211_validate_registry_update_receipt()

OPGP_ERROR_STATUS GP211_validate_registry_update_receipt ( PBYTE  receiptKey,
DWORD  keyLength,
GP211_RECEIPT_DATA  receiptData,
PBYTE  oldSecurityDomainAID,
DWORD  oldSecurityDomainAIDLength,
PBYTE  applicationAID,
DWORD  applicationAIDLength,
PBYTE  newSecurityDomainAID,
DWORD  newSecurityDomainAIDLength,
DWORD  applicationPrivileges,
PBYTE  registryUpdateParameters,
DWORD  registryUpdateParametersLength,
BYTE  receiptKeyType,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

GlobalPlatform2.3.1: Validates a Registry Update Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) receipt keys.

Validates a GlobalPlatform 2.3.1 Registry Update Receipt with symmetric (DES/AES) or asymmetric (RSA/ECC) keys.

◆ GP211_VISA1_derive_keys()

OPGP_ERROR_STATUS GP211_VISA1_derive_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the VISA 1 key derivation scheme.

E.g. GemXpresso cards use this scheme.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ GP211_VISA2_derive_keys()

OPGP_ERROR_STATUS GP211_VISA2_derive_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  AID,
DWORD  AIDLength,
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the VISA 2 key derivation scheme.

E.g. GemXpresso cards, JCOP-10 cards or Palmera Protect V5 cards use this scheme.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
AID[in] The AID of the Card Manager.
AIDLength[in] The length of the Card Manager AID / Issuer Security Domain AID.
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_calculate_3des_DAP()

OPGP_ERROR_STATUS OP201_calculate_3des_DAP ( PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
OPGP_STRING  executableLoadFileName,
BYTE  DAP_verification_key[16],
OP201_DAP_BLOCK dapBlock 
)

Open Platform: Calculates a Load File Data Block DAP using 3DES.

If a security domain has DAP verification privilege the security domain validates this DAP.

Parameters
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
executableLoadFileName[in] The name of the CAP or IJC file to calculate the DAP for.
DAP_verification_key[in] The key to calculate the DAP.
*dapBlock[out] A pointer to the returned OP201_DAP_BLOCK structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_calculate_install_token()

OPGP_ERROR_STATUS OP201_calculate_install_token ( BYTE  P1,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  AIDWithinLoadFileAID,
DWORD  AIDWithinLoadFileAIDLength,
PBYTE  applicationInstanceAID,
DWORD  applicationInstanceAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  applicationInstallParameters,
DWORD  applicationInstallParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installToken,
PDWORD  installTokenLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

Open Platform: Calculates an Install Token using PKCS#1.

The parameters must match the parameters of a later install_for_install(), install_for_make_selectable() and install_for_install_and_make_selectable() method.

Parameters
P1[in] The parameter P1 in the APDU command.
  • 0x04 for a INSTALL [for install] command
  • 0x08 for an INSTALL [for make selectable] command
  • 0x0C for an INSTALL [for install and make selectable]
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for install].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
AIDWithinLoadFileAID[in] The AID of the application class in the package.
AIDWithinLoadFileAIDLength[in] The length of the AIDWithinLoadFileAID buffer.
applicationInstanceAID[in] The AID of the installed application.
applicationInstanceAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See OP201_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
applicationInstallParameters[in] Applet install parameters for the install() method of the application.
applicationInstallParametersLength[in] The length of the applicationInstallParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installToken[out] The calculated Install Token. A 1024 bit RSA signature.
installTokenLength[in, out] The length of the installToken buffer.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_calculate_load_file_DAP()

OPGP_ERROR_STATUS OP201_calculate_load_file_DAP ( OP201_DAP_BLOCK dapBlock,
DWORD  dapBlockLength,
OPGP_STRING  executableLoadFileName,
BYTE  hash[20] 
)

Open Platform: Calculates a Load File DAP.

This is a hash of the Load File with SHA-1. A Load File consists of 0 to n Load File Data Block DAP blocks and a mandatory Load File Data Block, e.g. a CAP file. If no Load File Data Block DAP blocks are necessary the dapBlock must be NULL and the dapBlockLength 0. The dapBlock(s) can be calculated using calculate_3des_dap() or calculate_rsa_dap(). If the Load File Data Block DAP block(s) are already calculated they must be parsed into a OP201_DAP_BLOCK structure. If the Load File Data Block DAP block(s) are already prefixing the CAPFile following the Open Platform Specification 2.0.1', the whole CAPFile including the Load File Data Block DAP block(s) is sufficient, the dapBlock must be NULL and the dapBlockLength 0.

Parameters
*dapBlock[in] A pointer to OP201_DAP_BLOCK structure(s).
dapBlockLength[in] The number of OP201_DAP_BLOCK structure(s).
executableLoadFileName[in] The name of the CAP or IJC file to hash.
hash[out] The hash value. This are 20 bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_calculate_load_token()

OPGP_ERROR_STATUS OP201_calculate_load_token ( PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  loadFileDAP,
DWORD  loadFileDAPLength,
DWORD  nonVolatileCodeSpaceLimit,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  loadToken,
PDWORD  loadTokenLength,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

Open Platform: Calculates a Load Token using PKCS#1.

The parameters must match the parameters of a later install_for_load() method.

Parameters
executableLoadFileAID[in] A buffer containing the Executable Load File AID.
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
loadFileDAP[in] The Load File DAP. The same calculated as in install_for_load().
loadFileDAPLength[in] The length of the loadFileDAP buffer.
nonVolatileCodeSpaceLimit[in] The minimum space required to store the package.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
loadToken[out] The calculated Load Token. A 1024 bit RSA signature.
loadTokenLength[in, out] The length of the loadToken buffer.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_calculate_rsa_DAP()

OPGP_ERROR_STATUS OP201_calculate_rsa_DAP ( PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
OPGP_STRING  executableLoadFileName,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
OP201_DAP_BLOCK dapBlock 
)

Open Platform: Calculates a Load File Data Block DAP using SHA-1 and PKCS#1 (RSA).

If a security domain has DAP verification privilege the security domain validates this DAP.

Parameters
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
executableLoadFileName[in] The name of the CAP or IJC file to calculate the DAP for.
PEMKeyFileName[in] A PEM file name with the private RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
*dapBlock[out] A pointer to the returned OP201_DAP_BLOCK structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_delete_application()

OPGP_ERROR_STATUS OP201_delete_application ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
OPGP_AID AIDs,
DWORD  AIDsLength,
OP201_RECEIPT_DATA receiptData,
PDWORD  receiptDataLength 
)

Open Platform: Deletes a Executable Load File or an application.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
AIDs[in] A pointer to the an array of OPGP_AID structures describing the applications and load files to delete.
AIDsLength[in] The number of OPGP_AID structures.
*receiptData[out] A OP201_RECEIPT_DATA array. If the deletion is performed by a security domain with delegated management privilege this structure contains the according data for each deleted application or package.
receiptDataLength[in, out] A pointer to the length of the receiptData array. If no receiptData is available this length is 0;
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_delete_key()

OPGP_ERROR_STATUS OP201_delete_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex 
)

Open Platform: deletes a key or multiple keys.

If keyIndex is 0xFF all keys within a keySetVersion are deleted. If keySetVersion is 0x00 all keys with the specified keyIndex are deleted.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] An existing key index.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_EMV_CPS11_derive_keys()

OPGP_ERROR_STATUS OP201_EMV_CPS11_derive_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the EMV CPS 1.1 key derivation scheme.

E.g. Sm@rtCafe Expert 3.0 and later cards use this scheme.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_get_data()

OPGP_ERROR_STATUS OP201_get_data ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  identifier[2],
PBYTE  recvBuffer,
PDWORD  recvBufferLength 
)

Open Platform: Retrieve card data.

Retrieves a single card data object from the card identified by identifier. Some cards do not provide some data objects. Some possible identifiers are predefined. See OP201_GET_DATA_ISSUER_BIN and so on. For details about the coding of the response see the programmer's manual of your card. There is a convenience method get_key_information_templates() to get the key information template(s) containing key set version, key index, key type and key length of the keys.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
identifier[in] Two byte buffer with high and low order tag value for identifying card data object.
recvBuffer[in] The buffer for the card data object.
recvBufferLength[in] The length of the received card data object.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_get_install_token_signature_data()

OPGP_ERROR_STATUS OP201_get_install_token_signature_data ( BYTE  P1,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  AIDWithinLoadFileAID,
DWORD  AIDWithinLoadFileAIDLength,
PBYTE  applicationInstanceAID,
DWORD  applicationInstanceAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  applicationInstallParameters,
DWORD  applicationInstallParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installTokenSignatureData,
PDWORD  installTokenSignatureDataLength 
)

Open Platform: Function to retrieve the data to sign for delegated management in an Install Token.

If you are not the Card Issuer and do not know the token verification private key send this data to the Card Issuer and obtain the RSA signature of the data, i.e. the Install Token. volatileDataSpaceLimit can be 0, if the card does not need or support this tag. The parameters must match the parameters of a later install_for_install() and install_for_make_selectable() method.

Parameters
P1[in] The parameter P1 in the APDU command.
  • 0x04 for a INSTALL [for install] command
  • 0x08 for an INSTALL [for make selectable] command
  • 0x0C for an INSTALL [for install and make selectable]
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for load].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
AIDWithinLoadFileAID[in] The AID of the application class in the package.
AIDWithinLoadFileAIDLength[in] The length of the AIDWithinLoadFileAID buffer.
applicationInstanceAID[in] The AID of the installed application.
applicationInstanceAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See OP201_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
applicationInstallParameters[in] Applet install parameters for the install() method of the application.
applicationInstallParametersLength[in] The length of the applicationInstallParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installTokenSignatureData[out] The data to sign in a Install Token.
installTokenSignatureDataLength[in, out] The length of the installTokenSignatureData buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_get_key_information_templates()

OPGP_ERROR_STATUS OP201_get_key_information_templates ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  keyInformationTemplate,
OP201_KEY_INFORMATION keyInformation,
PDWORD  keyInformationLength 
)

Open Platform: Retrieves key information of keys on the card.

The card must support the optional report of key information templates.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
keyInformationTemplate[in] The number of the key information template.
*keyInformation[out] A pointer to an array of OP201_KEY_INFORMATION structures.
keyInformationLength[in, out] The number of OP201_KEY_INFORMATION structures.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_get_load_token_signature_data()

OPGP_ERROR_STATUS OP201_get_load_token_signature_data ( PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  loadFileDataBlockHash,
DWORD  loadFileDataBlockHashLength,
DWORD  nonVolatileCodeSpaceLimit,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  loadTokenSignatureData,
PDWORD  loadTokenSignatureDataLength 
)

Open Platform: Function to retrieve the data to sign for delegated management in a Load Token.

If you are not the Card Issuer and do not know the token verification private key send this data to the Card Issuer and obtain the RSA signature of the data, i.e. the Load Token. volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tags. The parameters must match the parameters of a later install_for_load() command.

Parameters
executableLoadFileAID[in] A buffer containing the Executable Load File AID.
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
securityDomainAID[in] A buffer containing the Security Domain AID.
securityDomainAIDLength[in] The length of the Security Domain AID.
loadFileDataBlockHash[in] The Load File DAP. The same calculated as in install_for_load().
loadFileDataBlockHashLength[in] The length of the loadFileDataBlockHash buffer.
nonVolatileCodeSpaceLimit[in] The minimum space required to store the application code.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
loadTokenSignatureData[out] The data to sign in a Load Token.
loadTokenSignatureDataLength[in, out] The length of the loadTokenSignatureData buffer.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_get_status()

OPGP_ERROR_STATUS OP201_get_status ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  cardElement,
OP201_APPLICATION_DATA applData,
PDWORD  applDataLength 
)

Open Platform: Gets the life cycle status of Applications, the Card Manager and Executable Load Files and their privileges.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
cardElement[in] Identifier to retrieve data for Load Files, Applications or the Card Manager.
*applData[out] The OP201_APPLICATION_DATA structure containing AID, life cycle state and privileges.
applDataLength[in, out] The number of OP201_APPLICATION_DATA passed and returned.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_install_for_install()

OPGP_ERROR_STATUS OP201_install_for_install ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  AIDWithinLoadFileAID,
DWORD  AIDWithinLoadFileAIDLength,
PBYTE  applicationInstanceAID,
DWORD  applicationInstanceAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  applicationInstallParameters,
DWORD  applicationInstallParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installToken,
DWORD  installTokenLength,
OP201_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

Open Platform: Installs an application on the card.

In the case of delegated management an Install Token authorizing the INSTALL [for install] must be included. See OP201_calculate_install_token(). Otherwise installToken must be NULL. See calculate_install_token(). volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tag. For Security domains look in your manual what parameters are necessary. If the tag for application install parameters is mandatory for your card, but you have no install parameters for the install() method of the application anyway you have to use at least a dummy parameter. If AIDWithinLoadFileAID is NULL and AIDWithinLoadFileAIDLength is 0 applicationInstanceAID is assumed for AIDWithinLoadFileAID

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for install].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
AIDWithinLoadFileAID[in] The AID of the application class in the package.
AIDWithinLoadFileAIDLength[in] The length of the AIDWithinLoadFileAID buffer.
applicationInstanceAID[in] The AID of the installed application.
applicationInstanceAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See OP201_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
applicationInstallParameters[in] Applet install parameters for the install() method of the application.
applicationInstallParametersLength[in] The length of the applicationInstallParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installToken[in] The Install Token. This is an assymetric (e.g., ECC or RSA) Signature.
installTokenLength[in] The length of the installToken buffer.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_install_for_install_and_make_selectable()

OPGP_ERROR_STATUS OP201_install_for_install_and_make_selectable ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  AIDWithinLoadFileAID,
DWORD  AIDWithinLoadFileAIDLength,
PBYTE  applicationInstanceAID,
DWORD  applicationInstanceAIDLength,
DWORD  applicationPrivileges,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  applicationInstallParameters,
DWORD  applicationInstallParametersLength,
PBYTE  sdParameters,
DWORD  sdParametersLength,
PBYTE  uiccSystemSpecParams,
DWORD  uiccSystemSpecParamsLength,
PBYTE  simSpecParams,
DWORD  simSpecParamsLength,
PBYTE  installToken,
DWORD  installTokenLength,
OP201_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

Open Platform: Installs and makes an installed application selectable.

In the case of delegated management an Install Token authorizing the INSTALL [for install and make selectable] must be included. See OP201_calculate_install_token(). Otherwise installToken must be NULL. See calculate_install_token(). volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tag. For Security domains look in your manual what parameters are necessary. If the tag for application install parameters is mandatory for your card, but you have no install parameters for the install() method of the application anyway you have to use at least a dummy parameter. If AIDWithinLoadFileAID is NULL and AIDWithinLoadFileAIDLength is 0 applicationInstanceAID is assumed for AIDWithinLoadFileAID.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for install].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
AIDWithinLoadFileAID[in] The AID of the application class in the package.
AIDWithinLoadFileAIDLength[in] The length of the AIDWithinLoadFileAID buffer.
applicationInstanceAID[in] The AID of the installed application.
applicationInstanceAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See OP201_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
applicationInstallParameters[in] Applet install parameters for the install() method of the application.
applicationInstallParametersLength[in] The length of the applicationInstallParameters buffer.
sdParameters[in] Security Domain install parameters encoded for tag C9 (e.g., tag 'C1' with tags '81','82','83','84','86','87').
sdParametersLength[in] The length of the sdParameters buffer.
uiccSystemSpecParams[in] UICC System Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.2.
uiccSystemSpecParamsLength[in] The length of the uiccSystemSpecParams buffer.
simSpecParams[in] SIM File Access and Toolkit Application Specific Parameters according to ETSI TS 102 226, sect. 8.2.1.3.2.1.
simSpecParamsLength[in] The length of the simSpecParams buffer.
installToken[in] The Install Token. This is an assymetric (e.g., ECC or RSA) Signature.
installTokenLength[in] The length of the installToken buffer.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_install_for_load()

OPGP_ERROR_STATUS OP201_install_for_load ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
PBYTE  loadFileDataBlockHash,
DWORD  loadFileDataBlockHashLength,
PBYTE  loadToken,
DWORD  loadTokenLength,
DWORD  nonVolatileCodeSpaceLimit,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit 
)

Open Platform: Prepares the card for loading an application.

The function assumes that the Card Manager or Security Domain uses an optional load file DAP using the SHA-1 message digest algorithm. The loadFileDAP can be calculated using calculate_load_file_DAP() or must be NULL, if the card does not need or support a Load File DAP in this situation, e.g. if you want to load a Executable Load File to the Card Manager Security Domain. In the case of delegated management a Load Token authorizing the INSTALL [for load] must be included. Otherwise loadToken must be NULL. See OP201_calculate_load_token(). The term Executable Load File is equivalent to the Open Platform term Load File Data Block. volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tags.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
executableLoadFileAID[in] A buffer with AID of the Executable Load File to INSTALL [for load].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
securityDomainAID[in] A buffer containing the AID of the intended associated Security Domain.
securityDomainAIDLength[in] The length of the Security Domain AID.
loadFileDataBlockHash[in] The load file DAP of the Executable Load File to INSTALL [for load].
loadFileDataBlockHashLength[in] The length of the loadFileDataBlockHash buffer.
loadToken[in] The Load Token. This is an assymetric (e.g., ECC or RSA) Signature.
loadTokenLength[in] The length of the loadToken buffer.
nonVolatileCodeSpaceLimit[in] The minimum amount of space that must be available to store the package.
volatileDataSpaceLimit[in] The minimum amount of RAM space that must be available.
nonVolatileDataSpaceLimit[in] The minimum amount of space for objects of the application, i.e. the data allocated in its lifetime.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_install_for_make_selectable()

OPGP_ERROR_STATUS OP201_install_for_make_selectable ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  applicationInstanceAID,
DWORD  applicationInstanceAIDLength,
DWORD  applicationPrivileges,
PBYTE  installToken,
DWORD  installTokenLength,
OP201_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable 
)

Open Platform: Makes an installed application selectable.

In the case of delegated management an Install Token authorizing the INSTALL [for make selectable] must be included. See OP201_calculate_install_token(). Otherwise installToken must be NULL. For Security domains look in your manual what parameters are necessary.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
applicationInstanceAID[in] The AID of the installed application or security domain.
applicationInstanceAIDLength[in] The length of the application instance AID.
applicationPrivileges[in] The application privileges. Can be an OR of multiple privileges. See OP201_APPLICATION_PRIVILEGE_SECURITY_DOMAIN.
installToken[in] The Install Token. This is an assymetric (e.g., ECC or RSA) Signature.
installTokenLength[in] The length of the installToken buffer.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data.
receiptDataAvailable[out] 0 if no receiptData is available.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_load()

OPGP_ERROR_STATUS OP201_load ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
OP201_DAP_BLOCK dapBlock,
DWORD  dapBlockLength,
OPGP_STRING  executableLoadFileName,
OP201_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable,
OPGP_PROGRESS_CALLBACK callback 
)

Open Platform: Loads a Executable Load File (containing an application) to the card.

An install_for_load() must precede. The Load File Data Block DAP block(s) must be the same block(s) and in the same order like in calculate_load_file_DAP(). If no Load File Data Block DAP blocks are necessary the dapBlock must be NULL and the dapBlockLength 0.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
*dapBlock[in] A pointer to OP201_DAP_BLOCK structure(s).
dapBlockLength[in] The number of OP201_DAP_BLOCK structure(s).
executableLoadFileName[in] The name of the CAP or IJC file to load.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data. Can be validated with validate_load_receipt().
receiptDataAvailable[out] 0 if no receiptData is available.
*callback[in] A pointer to a OPGP_PROGRESS_CALLBACK defining the callback function and optional parameters for it.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_load_from_buffer()

OPGP_ERROR_STATUS OP201_load_from_buffer ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
OP201_DAP_BLOCK dapBlock,
DWORD  dapBlockLength,
PBYTE  loadFileBuf,
DWORD  loadFileBufSize,
OP201_RECEIPT_DATA receiptData,
PDWORD  receiptDataAvailable,
OPGP_PROGRESS_CALLBACK callback 
)

Open Platform: Loads a Executable Load File (containing an application) from a buffer to the card.

An install_for_load() must precede. The Load File Data Block DAP block(s) must be the same block(s) and in the same order like in calculate_load_file_DAP(). If no Load File Data Block DAP blocks are necessary the dapBlock must be NULL and the dapBlockLength 0.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
*dapBlock[in] A pointer to OP201_DAP_BLOCK structure(s).
dapBlockLength[in] The number of OP201_DAP_BLOCK structure(s).
loadFileBuf[in] buffer with the contents of a Executable Load File.
loadFileBufSize[in] size of loadFileBuf.
*receiptData[out] If the deletion is performed by a security domain with delegated management privilege this structure contains the according data. Can be validated with validate_load_receipt().
receiptDataAvailable[out] 0 if no receiptData is available.
*callback[in] A pointer to a OPGP_PROGRESS_CALLBACK defining the callback function and optional parameters for it.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_mutual_authentication()

OPGP_ERROR_STATUS OP201_mutual_authentication ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
PBYTE  baseKey,
PBYTE  encKey,
PBYTE  macKey,
PBYTE  kekKey,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  securityLevel,
BYTE  derivationMethod,
OP201_SECURITY_INFO secInfo 
)

Open Platform: Mutual authentication.

A keySetVersion and keyIndex of 0x00 selects the first available key set version and key index. If a derivation method is used the baseKey defines the master key.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
baseKey[in] The master key used for the key derivation.
encKey[in] The static encryption key.
macKey[in] The static MAC key.
kekKey[in] The static Key Encryption key.
keySetVersion[in] The key set version on the card to use for mutual authentication.
keyIndex[in] The key index of the encryption key in the key set version on the card to use for mutual authentication.
securityLevel[in] The requested security level.
derivationMethod[in] The derivation method to use for. See OPGP_DERIVATION_METHOD_VISA2.
*secInfo[out] The returned OP201_SECURITY_INFO structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_pin_change()

OPGP_ERROR_STATUS OP201_pin_change ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  tryLimit,
PBYTE  newPIN,
DWORD  newPINLength,
BYTE  KEK[16] 
)

Open Platform: Changes or unblocks the global PIN.

The single numbers of the new PIN are encoded as single BYTEs in the newPIN buffer. The tryLimit must be in the range of 0x03 and x0A. The PIN must comprise at least 6 numbers and not exceeding 12 numbers. To unblock the PIN use tryLimit with a value of 0x00. In this case newPIN buffer and newPINLength are ignored.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
tryLimit[in] The try limit for the PIN.
newPIN[in] The new PIN.
newPINLength[in] The length of the new PIN.
KEK[in] The Key Encryption key (KEK).
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_put_3desKey()

OPGP_ERROR_STATUS OP201_put_3desKey ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
BYTE  _3desKey[16] 
)

Open Platform: replaces a single 3DES key in a key set or adds a new 3DES key.

A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version a new key belongs to. This can be the same key version or a new not yet existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The new key set version.
_3desKey[in] The new 3DES key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_put_data()

OPGP_ERROR_STATUS OP201_put_data ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  identifier[2],
PBYTE  dataObject,
DWORD  dataObjectLength 
)

Open Platform: Put card data.

Puts a single card data object identified by identifier. Some cards do not provide some data objects. Some possible identifiers are predefined. See OP201_GET_DATA_ISSUER_BIN. For details about the coding of the dataObject see the programmer's manual of your card.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
identifier[in] Two byte buffer with high and low order tag value for identifying card data object.
dataObject[in] The coded data object.
dataObjectLength[in] The length of the data object.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_put_delegated_management_keys()

OPGP_ERROR_STATUS OP201_put_delegated_management_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase,
BYTE  receiptGenerationKey[16] 
)

Open Platform: Adds a key set for Delegated Management.

A keySetVersion value of 0x00 adds a new secure channel key set. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version a the new secure channel keys belongs to. This can be the same key version or a new not existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
keySetVersion[in] An existing key set version.
newKeySetVersion[in] The new key set version.
PEMKeyFileName[in] A PEM file name with the public RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
receiptGenerationKey[in] The new Receipt Generation key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_put_rsa_key()

OPGP_ERROR_STATUS OP201_put_rsa_key ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  keyIndex,
BYTE  newKeySetVersion,
OPGP_STRING  PEMKeyFileName,
char *  passPhrase 
)

Open Platform: replaces a single public RSA key in a key set or adds a new public RSA key.

A keySetVersion value of 0x00 adds a new key. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version a new key belongs to. This can be the same key version or a new not existing key set version.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
keySetVersion[in] An existing key set version.
keyIndex[in] The position of the key in the key set version.
newKeySetVersion[in] The new key set version.
PEMKeyFileName[in] A PEM file name with the public RSA key.
*passPhrase[in] The passphrase. Must be an ASCII string.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_put_secure_channel_keys()

OPGP_ERROR_STATUS OP201_put_secure_channel_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  keySetVersion,
BYTE  newKeySetVersion,
BYTE  new_encKey[16],
BYTE  new_macKey[16],
BYTE  new_KEK[16] 
)

Open Platform: replaces or adds a secure channel key set consisting of encryption key, MAC key and key encryption.

A keySetVersion value of 0x00 adds a new secure channel key set. Any other value between 0x01 and 0x7f must match an existing key set version. The new key set version defines the key set version the new secure channel keys belongs to. This can be the same key version or a new not existing key set version. Sometimes a key derivation of the put keys might be necessary so it is necessary to call OP201_EMV_CPS11_derive_keys() or any other derivation function.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
keySetVersion[in] An existing key set version.
newKeySetVersion[in] The new key set version.
new_encKey[in] The new Encryption key.
new_macKey[in] The new MAC key.
new_KEK[in] The new key encryption key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_send_APDU()

OPGP_ERROR_STATUS OP201_send_APDU ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  capdu,
DWORD  capduLength,
PBYTE  rapdu,
PDWORD  rapduLength 
)

Sends an application protocol data unit.

The secInfo pointer can also be null and so this function can be used for arbitrary cards.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
capdu[in] The command APDU.
capduLength[in] The length of the command APDU.
rapdu[out] The response APDU.
rapduLength[in, out] The length of the response APDU.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_set_status()

OPGP_ERROR_STATUS OP201_set_status ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
BYTE  statusType,
PBYTE  AID,
DWORD  AIDLength,
BYTE  lifeCycleState 
)

Open Platform: Sets the life cycle status of Applications, Security Domains or the Card Manager.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
statusType[in] Identifier for Load Files, Applications or the Card Manager.
AID[in] The AID.
AIDLength[in] The length of the AID.
lifeCycleState[in] The new life cycle state.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_validate_delete_receipt()

OPGP_ERROR_STATUS OP201_validate_delete_receipt ( DWORD  confirmationCounter,
BYTE  cardUniqueData[10],
BYTE  receiptGenerationKey[16],
OP201_RECEIPT_DATA  receiptData,
PBYTE  AID,
DWORD  AIDLength 
)

Open Platform: Validates a Load Receipt.

Each time a receipt is generated the confirmation counter is incremented by the Card Manager. You may keep track of it. Returns OPGP_ERROR_SUCCESS if receipt is valid.

Parameters
confirmationCounter[in] The confirmation counter.
cardUniqueData[in] The card unique data (?).
receiptGenerationKey[in] The 3DES key to generate the receipt.
receiptData[in] The OP201_RECEIPT_DATA structure containing the receipt returned from delete_application() to verify.
AID[in] A buffer with AID of the application which was deleted.
AIDLength[in] The length of the AID.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_validate_install_receipt()

OPGP_ERROR_STATUS OP201_validate_install_receipt ( DWORD  confirmationCounter,
BYTE  cardUniqueData[10],
BYTE  receiptGenerationKey[16],
OP201_RECEIPT_DATA  receiptData,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  applicationInstanceAID,
DWORD  applicationInstanceAIDLength 
)

Open Platform: Validates an Install Receipt.

Each time a receipt is generated the confirmation counter is incremented by the Card Manager. You may keep track of it. Returns OPGP_ERROR_SUCCESS if receipt is valid.

Parameters
confirmationCounter[in] The confirmation counter.
cardUniqueData[in] The card unique data (?).
receiptGenerationKey[in] The 3DES key to generate the receipt.
receiptData[in] The OP201_RECEIPT_DATA structure containing the receipt returned from install_for_install() to verify.
executableLoadFileAID[in] A buffer with AID of the Executable Load File which was INSTALL [for install].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
applicationInstanceAID[in] The AID of the installed application.
applicationInstanceAIDLength[in] The length of the application instance AID.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_validate_load_receipt()

OPGP_ERROR_STATUS OP201_validate_load_receipt ( DWORD  confirmationCounter,
BYTE  cardUniqueData[10],
BYTE  receiptGenerationKey[16],
OP201_RECEIPT_DATA  receiptData,
PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength 
)

Open Platform: Validates a Load Receipt.

Each time a receipt is generated the confirmation counter is incremented by the Card Manager. You may keep track of it. Returns OPGP_ERROR_SUCCESS if receipt is valid.

Parameters
confirmationCounter[in] The confirmation counter.
cardUniqueData[in] The card unique data (?).
receiptGenerationKey[in] The 3DES key to generate the receipt.
receiptData[in] The OP201_RECEIPT_DATA structure containing the receipt returned from load_application() to verify.
executableLoadFileAID[in] A buffer with AID of the Executable Load File which was INSTALL [for load].
executableLoadFileAIDLength[in] The length of the Executable Load File AID.
securityDomainAID[in] A buffer containing the AID of the associated Security Domain.
securityDomainAIDLength[in] The length of the Security Domain AID.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_VISA1_derive_keys()

OPGP_ERROR_STATUS OP201_VISA1_derive_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the VISA 1 key derivation scheme.

E.g. GemXpresso cards use this scheme.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OP201_VISA2_derive_keys()

OPGP_ERROR_STATUS OP201_VISA2_derive_keys ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
OP201_SECURITY_INFO secInfo,
PBYTE  AID,
DWORD  AIDLength,
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the VISA 2 key derivation scheme.

E.g. GemXpresso cards, JCOP-10 cards or Palmera Protect V5 cards use this scheme.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO cardInfo, structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the OP201_SECURITY_INFO structure returned by OP201_mutual_authentication().
AID[in] The AID of the Card Manager.
AIDLength[in] The length of the Card Manager AID / Issuer Security Domain AID.
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_build_bcd_encoding()

OPGP_ERROR_STATUS OPGP_build_bcd_encoding ( const char *  numericString,
PBYTE  bcdData,
PDWORD  bcdDataLength 
)

BCD encodes a numeric string.

Encodes an ASCII decimal string as packed BCD. Digits are written high nibble first; odd length strings are padded with 0xF in the low nibble of the last byte.

Parameters
numericString[in] Null terminated string containing only decimal digits.
bcdData[out] The output buffer for the BCD encoded data.
bcdDataLength[in, out] The length of bcdData and, on success, the number of encoded bytes.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ OPGP_calculate_key_check_value()

OPGP_ERROR_STATUS OPGP_calculate_key_check_value ( GP211_SECURITY_INFO secInfo,
BYTE  keyType,
PBYTE  keyData,
DWORD  keyDataLength,
BYTE  keyCheckValue[3] 
)

Calculates the key check value of a key.

Parameters
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
keyType[in] The key type. See GP211_KEY_TYPE_AES.
keyData[in] The key data.
keyDataLength[in] The key data length.
keyCheckValue[out] The key check value.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_cap_to_ijc()

OPGP_ERROR_STATUS OPGP_cap_to_ijc ( OPGP_CSTRING  capFileName,
OPGP_STRING  ijcFileName 
)

Converts a CAP file to an IJC file (Executable Load File).

Parameters
capFileName[in] The name of the CAP file.
ijcFileName[in] The name of the destination IJC file.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_encrypt_sensitive_data()

OPGP_ERROR_STATUS OPGP_encrypt_sensitive_data ( GP211_SECURITY_INFO secInfo,
PBYTE  data,
DWORD  dataLength,
PBYTE  encryptedData,
PDWORD  encryptedDataLength 
)

Encrypts sensitive data like keys or other data which is used in STORE DATA.

Parameters
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
data[in] The data to encrypt.
dataLength[in] The data length.
encryptedData[out] The encrypted data. No length checking is done. The buffer must have sufficient size, e.g. the next block size or twice the data size if unsure.
encryptedDataLength[out] The length of the encrypted data.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_extract_cap_file()

OPGP_ERROR_STATUS OPGP_extract_cap_file ( OPGP_CSTRING  fileName,
PBYTE  loadFileBuf,
PDWORD  loadFileBufSize 
)

Extracts a CAP file into a buffer.

If loadFileBuf is NULL the loadFileBufSize is ignored and the necessary buffer size is returned in loadFileBufSize and the functions returns.

Parameters
fileName[in] The name of the CAP file.
loadFileBuf[out] The destination buffer with the Executable Load File contents.
loadFileBufSize[in, out] The size of the loadFileBuf.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_get_cplc()

OPGP_ERROR_STATUS OPGP_get_cplc ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
OPGP_CPLC cplc 
)

Reads and parses the CPLC data.

Retrieves and parses the Card Production Life Cycle data object. The CPLC data is read with GET DATA tag 9F7F and parsed into OPGP_CPLC.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context().
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication(), or NULL if the command is sent without secure messaging.
cplc[out] The parsed CPLC structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ OPGP_get_extended_card_resources_information()

OPGP_ERROR_STATUS OPGP_get_extended_card_resources_information ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
OPGP_EXTENDED_CARD_RESOURCE_INFORMATION extendedCardResourceInformation 
)

Reads the extended card resource information (number of applications + free memory).

The ISD must support the optional report of extended card resources information. The format is defined in ETSI TS 102 226, sect. 8.2.1.7.2.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
*extendedCardResourceInformation[out] A pointer to an array of OPGP_EXTENDED_CARD_RESOURCE_INFORMATION structures.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_manage_channel()

OPGP_ERROR_STATUS OPGP_manage_channel ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO cardInfo,
GP211_SECURITY_INFO secInfo,
BYTE  openClose,
BYTE  channelNumberToClose,
BYTE channelNumberOpened 
)

ISO 7816-4 / GlobalPlatform2.1.1: Opens or closes a Logical Channel.

For an OPEN command, the channelNumberToClose is ignored. For an CLOSE command, the channelNumberOpened is returned. After closing a Logical Channel the Basic Logical Channel is assumed for the next transmissions.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
*cardInfo[in, out] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure returned by GP211_mutual_authentication().
openClose[in] Logical Channel should be opened or closed. See GP211_MANAGE_CHANNEL_OPEN.
channelNumberToClose[in] The Logical Channel number to close.
channelNumberOpened[out] The Logical Channel number opened.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_parse_cplc()

OPGP_ERROR_STATUS OPGP_parse_cplc ( const BYTE data,
DWORD  dataLength,
OPGP_CPLC cplc 
)

Parses the CPLC data response.

Parses Card Production Life Cycle data. The input may be either the raw 42 byte CPLC value or a GET DATA response wrapped in tag 9F7F.

Parameters
data[in] The raw CPLC value or the tag 9F7F wrapped CPLC data.
dataLength[in] The length of data.
cplc[out] The parsed CPLC structure.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ OPGP_parse_extended_card_resources_information()

OPGP_ERROR_STATUS OPGP_parse_extended_card_resources_information ( const BYTE data,
DWORD  dataLength,
OPGP_EXTENDED_CARD_RESOURCE_INFORMATION extendedCardResourceInformation 
)

Parses the extended card resources information response.

Parses an Extended Card Resources Information response. The input must contain tag FF21 and may include the number of installed applications, free non-volatile memory and free volatile memory.

Parameters
data[in] The extended card resources information response.
dataLength[in] The length of data.
extendedCardResourceInformation[out] The parsed extended card resources information.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct.

◆ OPGP_read_executable_load_file_parameters()

OPGP_ERROR_STATUS OPGP_read_executable_load_file_parameters ( OPGP_STRING  loadFileName,
OPGP_LOAD_FILE_PARAMETERS loadFileParams 
)

Reads the parameters of an Executable Load File.

Parameters
loadFileName[in] The load file name to parse.
*loadFileParams[out] The parsed parameters.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_read_executable_load_file_parameters_from_buffer()

OPGP_ERROR_STATUS OPGP_read_executable_load_file_parameters_from_buffer ( PBYTE  loadFileBuf,
DWORD  loadFileBufSize,
OPGP_LOAD_FILE_PARAMETERS loadFileParams 
)

Receives Executable Load File as a buffer instead of a FILE.

Parameters
loadFileBuf[in] The load file buffer.
loadFileBufSize[in] The size of the load file buffer.
*loadFileParams[out] The parsed parameters.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_select_application()

OPGP_ERROR_STATUS OPGP_select_application ( OPGP_CARD_CONTEXT  cardContext,
OPGP_CARD_INFO  cardInfo,
GP211_SECURITY_INFO secInfo,
PBYTE  AID,
DWORD  AIDLength 
)

GlobalPlatform2.1.1: Selects an application on a card by AID and resets secure channel state.

Parameters
cardContext[in] The valid OPGP_CARD_CONTEXT returned by OPGP_establish_context()
cardInfo[in] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
*secInfo[in, out] The pointer to the GP211_SECURITY_INFO structure. If non-null, the secure channel state is reset after a successful select.
AID[in] The AID.
AIDLength[in] The length of the AID.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ OPGP_select_channel()

OPGP_ERROR_STATUS OPGP_select_channel ( OPGP_CARD_INFO cardInfo,
BYTE  channelNumber 
)

ISO 7816-4 / GlobalPlatform2.1.1: If multiple Logical Channels are open or a new Logical Channel is opened with select_application(), selects the Logical Channel.

You must track on your own, what channels are open.

Parameters
*cardInfo[in, out] The OPGP_CARD_INFO structure returned by OPGP_card_connect().
channelNumber[in] The Logical Channel number to select.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ readDAPBlock()

OPGP_NO_API OPGP_ERROR_STATUS readDAPBlock ( PBYTE  buf,
PDWORD  bufLength,
OP201_DAP_BLOCK  dapBlock 
)

Reads a DAP block and parses it to the buffer buf.

Parameters
buf[out] The buffer.
bufLength[in, out] The length of the buffer and the returned data.
dapBlock[in] The Load File Data Block DAP block.
Returns
OPGP_ERROR_SUCCESS if no error, error code else

◆ VISA1_derive_keys()

OPGP_ERROR_STATUS VISA1_derive_keys ( BYTE  cardSerialNumber[8],
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the VISA 1 key derivation scheme.

E.g. GemXpresso cards use this scheme.

Parameters
cardSerialNumber[in] The card serial number.
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct

◆ VISA2_derive_keys()

OPGP_ERROR_STATUS VISA2_derive_keys ( BYTE  baseKeyDiversificationData[10],
PBYTE  masterKey,
PBYTE  S_ENC,
PBYTE  S_MAC,
PBYTE  DEK 
)

Derives the static keys from a master key according the VISA 2 key derivation scheme.

E.g. GemXpresso cards, JCOP-10 cards or Palmera Protect V5 cards use this scheme. The baseKeyDiversificationData must contain the rightmost two bytes of the Card Manager AID as first 2 bytes and starting at position 4 the 4 bytes of the IC serial number.

Parameters
baseKeyDiversificationData[in] The key diversification data. This is returned by INITIALIZE UPDATE or can be constructed.
masterKey[in] The master key.
S_ENC[out] The static Encryption key.
S_MAC[out] The static Message Authentication Code key.
DEK[out] The static Key Encryption Key.
Returns
OPGP_ERROR_STATUS struct with error status OPGP_ERROR_STATUS_SUCCESS if no error occurs, otherwise error code and error message are contained in the OPGP_ERROR_STATUS struct