globalplatform
Functions
loadfile.h File Reference
#include "globalplatform/types.h"
#include "globalplatform/error.h"
#include "globalplatform/library.h"
#include "globalplatform/globalplatform.h"
Include dependency graph for loadfile.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

OPGP_NO_API OPGP_ERROR_STATUS handle_load_file (OPGP_CSTRING fileName, PBYTE loadFileBuf, PDWORD loadFileBufSize)
 Handles a CAP or IJC file and copies the Executable Load File contents. More...
 
OPGP_NO_API OPGP_ERROR_STATUS extract_cap_file (OPGP_CSTRING fileName, PBYTE loadFileBuf, PDWORD loadFileBufSize)
 Extracts a CAP file. More...
 
OPGP_NO_API OPGP_ERROR_STATUS read_load_file_data_block_signature (PBYTE buf, PDWORD bufLength, GP211_DAP_BLOCK loadFileDataBlockSignature)
 Reads a DAP block and parses it to the buffer buf. More...
 
OPGP_NO_API OPGP_ERROR_STATUS cap_to_ijc (OPGP_CSTRING capFileName, OPGP_STRING ijcFileName)
 Converts a CAP file to an IJC file (Executable Load File). More...
 
OPGP_NO_API OPGP_ERROR_STATUS get_load_data (PBYTE executableLoadFileAID, DWORD executableLoadFileAIDLength, PBYTE securityDomainAID, DWORD securityDomainAIDLength, BYTE loadFileDataBlockHash[20], DWORD nonVolatileCodeSpaceLimit, DWORD volatileDataSpaceLimit, DWORD nonVolatileDataSpaceLimit, PBYTE loadData, PDWORD loadDataLength)
 Gets the data for a GP211_install_for_load() command. More...
 
OPGP_NO_API OPGP_ERROR_STATUS read_executable_load_file_parameters (OPGP_STRING loadFileName, OPGP_LOAD_FILE_PARAMETERS *loadFileParams)
 Can read CAP and IJC files (concatenated extracted CAP files). More...
 
OPGP_NO_API OPGP_ERROR_STATUS read_executable_load_file_parameters_from_buffer (PBYTE loadFileBuf, DWORD loadFileBufSize, OPGP_LOAD_FILE_PARAMETERS *loadFileParams)
 Reads Executable Load File parameters from a buffer. More...
 

Detailed Description

This file contains Load File functionality.

Function Documentation

◆ cap_to_ijc()

OPGP_NO_API OPGP_ERROR_STATUS 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_SUCCESS if no error, error code else.

◆ extract_cap_file()

OPGP_NO_API OPGP_ERROR_STATUS extract_cap_file ( OPGP_CSTRING  fileName,
PBYTE  loadFileBuf,
PDWORD  loadFileBufSize 
)

Extracts a CAP file.

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_SUCCESS if no error, error code else.

◆ get_load_data()

OPGP_NO_API OPGP_ERROR_STATUS get_load_data ( PBYTE  executableLoadFileAID,
DWORD  executableLoadFileAIDLength,
PBYTE  securityDomainAID,
DWORD  securityDomainAIDLength,
BYTE  loadFileDataBlockHash[20],
DWORD  nonVolatileCodeSpaceLimit,
DWORD  volatileDataSpaceLimit,
DWORD  nonVolatileDataSpaceLimit,
PBYTE  loadData,
PDWORD  loadDataLength 
)

Gets the data for a GP211_install_for_load() command.

volatileDataSpaceLimit and nonVolatileDataSpaceLimit can be 0, if the card does not need or support this tags.

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.
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.
loadData[out] The data to sign in a load data.
loadDataLength[in, out] The length of the loadData buffer.
Returns
OPGP_ERROR_SUCCESS if no error, error code else.

◆ handle_load_file()

OPGP_NO_API OPGP_ERROR_STATUS handle_load_file ( OPGP_CSTRING  fileName,
PBYTE  loadFileBuf,
PDWORD  loadFileBufSize 
)

Handles a CAP or IJC file and copies the Executable Load File contents.

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 or IJC file.
loadFileBuf[out] The destination buffer with the Executable Load File contents.
loadFileBufSize[in, out] The size of the loadFileBuf.
Returns
OPGP_ERROR_SUCCESS if no error, error code else.

◆ read_executable_load_file_parameters()

OPGP_NO_API OPGP_ERROR_STATUS read_executable_load_file_parameters ( OPGP_STRING  loadFileName,
OPGP_LOAD_FILE_PARAMETERS loadFileParams 
)

Can read CAP and IJC files (concatenated extracted CAP files).

Parameters
loadFileName[in] The name of the Executable Load File.
loadFileParams[out] The parameters of the Executable Load File.
Returns
OPGP_ERROR_SUCCESS if no error, error code else.

◆ read_executable_load_file_parameters_from_buffer()

OPGP_NO_API OPGP_ERROR_STATUS read_executable_load_file_parameters_from_buffer ( PBYTE  loadFileBuf,
DWORD  loadFileBufSize,
OPGP_LOAD_FILE_PARAMETERS loadFileParams 
)

Reads Executable Load File parameters from a buffer.

Parameters
loadFileBuf[in] contents of a Executable Load File.
loadFileBufSize[in] size of loadFileBuf.
loadFileParams[out] The parameters of the Executable Load File.
Returns
OPGP_ERROR_SUCCESS if no error, error code else.

◆ read_load_file_data_block_signature()

OPGP_NO_API OPGP_ERROR_STATUS read_load_file_data_block_signature ( PBYTE  buf,
PDWORD  bufLength,
GP211_DAP_BLOCK  loadFileDataBlockSignature 
)

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

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.
loadFileDataBlockSignature[in] The Load File Data Block Signature.
Returns
OPGP_ERROR_SUCCESS if no error, error code else