API Reference

APP API Reference

Complete reference for all APP API messages used to communicate with AppEndpoint.

Request Messages

Messages sent from your application to AppEndpoint.

Code Name Description
0x01 GET_ENDPOINT_INFO_REQUEST Get information about the local endpoint
0x02 GET_ATRS_INFO_REQUEST Get list of all ATRs on this endpoint
0x03 GET_VERSION_REQUEST Get AppEndpoint version information
0x04 REGISTER_APP_REQUEST Register application with ATR
0x05 SEND_APP_DATA_REQUEST Send data to remote application

GET_ENDPOINT_INFO_REQUEST (0x01)

Retrieves information about the local endpoint including name, ID, and status.

# Payload: opcode only (4 bytes)
payload = struct.pack("<L", 0x01)
packet = build_akm_header(len(payload)) + payload
sock.sendall(packet)

GET_ATRS_INFO_REQUEST (0x02)

Retrieves information about all ATRs configured on this endpoint (up to 10).

# Payload: opcode only (4 bytes)
payload = struct.pack("<L", 0x02)
packet = build_akm_header(len(payload)) + payload
sock.sendall(packet)

REGISTER_APP_REQUEST (0x04)

Registers your application with a specific ATR and App Value.

Field Type Description
Opcode U32 0x00000004
ATR_ID U16 Abbreviated ATR ID
App_Value U16 Unique application identifier
# Payload: opcode (4) + ATR_ID (2) + App_Value (2) = 8 bytes
payload = struct.pack("<LHH", 0x04, atr_id, app_value)
packet = build_akm_header(len(payload)) + payload
sock.sendall(packet)

SEND_APP_DATA_REQUEST (0x05)

Sends data to a remote application through the encrypted channel.

Field Type Description
Opcode U32 0x00000005
ATR_ID U16 Target ATR ID
Target_App_Value U16 Target application's App Value
Data bytes[4046] Data buffer (zero-padded)
Length U32 Actual data length
MAX_APP_BUFFER_SIZE = 4046
FMT = f"<LHH{MAX_APP_BUFFER_SIZE}sL"

data = message.encode()
padded = data.ljust(MAX_APP_BUFFER_SIZE, b"\x00")

payload = struct.pack(FMT, 0x05, atr_id, target_app, padded, len(data))
packet = build_akm_header(len(payload)) + payload
sock.sendall(packet)

Response Messages

Messages received from AppEndpoint.

Code Name Description
0x41 GET_ENDPOINT_INFO_RESPONSE Endpoint information
0x42 GET_ATRS_INFO_RESPONSE ATR list (up to 10)
0x43 GET_VERSION_RESPONSE Version information
0x44 REGISTER_APP_RESPONSE Registration confirmation
0x46 RECEIVE_APP_DATA_RESPONSE Incoming data from remote app

GET_ATRS_INFO_RESPONSE (0x42)

Field Type Description
Opcode U32 0x00000042
Conf_Code U32 0 = success
Num_ATRs U32 Number of ATRs (max 10)
ATR_Block bytes[2240] Array of 10 ATR structs (224 bytes each)

REGISTER_APP_RESPONSE (0x44)

Field Type Description
Opcode U32 0x00000044
Conf_Code U32 0 = success, 1 = error
ATR_ID U16 Registered ATR ID
App_Value U16 Registered App Value

RECEIVE_APP_DATA_RESPONSE (0x46)

Received asynchronously when data arrives from a remote application.

Field Type Description
Opcode U32 0x00000046
ATR_ID U16 Source ATR ID
Source_App_Value U16 Sender's App Value
Data bytes[4046] Data buffer
Length U32 Actual data length

Data Structures

ATR Structure (224 bytes)

Offset Size Field
16 20 ATR Name
36 2 Abbreviated ID (U16)
38 2 Active Status (U16)
40 4 Category (U32: 0=Provisioning, 1=Operational)
64 20 Server Name
120 20 Client Name