TEF950-S003-01.00.00/en

e2TP Message Specification

TEF950-S003-01.00.00/en

2005/03
T-Engine ForumCopyright © 2005 by T-Engine Forum. All rights reserved.

TEF950-S003-01.00.00/en

Contents
1.

Introduction ------------------------------------------------------------------------------------------------------------------- 1
1.1. Outline of this specification ....................................................................................................................... 1
1.1.1. TENeT architecture.............................................................................................................................. 1

2.

1.2.

Positioning of this specification ................................................................................................................. 2

1.3.

Scope of specification ................................................................................................................................ 2

1.4.

Normative reference ................................................................................................................................... 2

1.5.

Terminology ............................................................................................................................................... 2

1.6.

Endians....................................................................................................................................................... 2e2TP Messages --------------------------------------------------------------------------------------------------------------- 2This section explains the format of e2TP messages and their contents ---------------------------------------------- 2
2.1. e2TP message format ................................................................................................................................. 2
2.1.1. eTRON ID............................................................................................................................................ 3
2.1.2. Message types ...................................................................................................................................... 4
2.1.3. Thread ID ............................................................................................................................................. 4

3.

Mapping to ISO7816-4 APDU --------------------------------------------------------------------------------------------- 5
3.1.

APDU format ............................................................................................................................................. 5

3.2.

TENeT command format............................................................................................................................ 5

3.3. TENeT response formats............................................................................................................................ 6
3.3.1. On a normal processing........................................................................................................................ 63.3.2. On an abnormal end ............................................................................................................................. 6
3.3.3. Response format containing multiple messages................................................................................... 7Copyright © 2005 by T-Engine Forum. All rights served.
ii

TEF950-S003-01.00.00/en

1. Introduction
This specification prescribes the formats of the e2TP messages and the method of mapping them to theISO7816-4 APDU.

1.1 Outline of this specification
The TENeT is a framework designed to implement safe transactions of e-rights/e-money in a mobileenvironment. There are IC cards and mobile terminals on the TENeT. It is presupposed that an IC card
inserted into a mobile terminal is used from an application programs on the mobile terminal.
The application issues operating instructions and responses by interchanging messages with the IC card.
For this interchange of messages, the TENeT adopts the message passing format. Therefore, the applicationand the IC card can start transacting with another party after sending out a message, without having to wait fora response from the remote party.
Moreover, when the distributed transparency type message delivery mechanism of the TENeT is employed,
the application does not have to apply relay processing to output messages from the card.
This specification establishes the e2TP message formats that are common for the messages delivered overthe TENeT.

1.1.1

TENeT architecture

Figure 1 represents the TENeT architecture that delivers messages in the form of distributed transparency
between IC cards and between IC cards and applications. The messaging library transmits and receives thee2TP messages synchronously (waits for a response message to a transmitted message) or asynchronously(continues processing after transmitting a message, without waiting for a response message). When theapplication has conducted an asynchronous message transmission, it acquires a receiving message by an event
listener registered in advance, similarly to other event-driven systems (GUI framework, etc.)
According to this architecture, when an IC card or application outputs an e2TP message, the messaging
library first accepts the message and transmits it to the destination. Therefore, a message which is output by anIC card with destination to another IC card is transmitted by the messaging library directly to the destination
IC card. This eliminates the need for relay processing by an application.

Figure 1. TENeT architecture

Copyright © 2005 by T-Engine Forum. All rights served.
1

TEF950-S003-01.00.00/en

1.2 Positioning of this specification
To achieve the interoperability of IC cards and application programs that implement e-rights/e-moneytransactions, the TENeT has the following types of specifications prescribed:
TENeT e-rights/e-money transaction API specification
API designed to have the e-rights/e-money of an IC card managed and circulated from an application
program.
TENeT messaging API specification
API designed to transmit/receive e2TP messages to/from an application program.
Extended eTP (e2TP) message specification (This document)
Formats of e2TP messages and method of mapping them to the ISO7816-4 APDU.
TENeT message specificatione2TP message sets with which TENeT-enabled IC cards should be provided.

1.3 Scope of specification
This document specifies the formats of e2TP messages and the method of mapping of those messages to theISO7816-4 APDU for their input/output to/from IC cards.

1.4 Normative reference
ISO/IEC Integrated circuit(s) cards with contacts
Part 4: Interindustry commands for interchange, ISO/IEC 7816-4: 1995(E)

1.5 Terminology-Table 1 defines the common terms employed in this document.

TermMeaning

B

Abbreviation of Byte
Indicates the byte.

MSB

Abbreviation of Most Significant Bit
Indicates the highest-order bit of an array of bytes.

1.6 Endians
The network endians (big endians) are employed as endians for all of the values on the e2TP message.

Copyright © 2005 by T-Engine Forum. All rights served.
2TEF950-S003-01.00.00/en

2. e2TP Messages
This section explains the format of e2TP messages and their contents.

2.1 e2TP message format
To allow application programs to use the distributed processing between IC cards easily, the TENeT isprovided with a mechanism designed to interchange messages in the form of distributed transparency between
IC cards or between IC cards and application programs. In the TENeT, the messages delivered by means of
this mechanism are called e2TP (extended eTRON Transfer Protocol) messages. Table 2 gives the format of
the e2TP message.
The leading byte of the format value represents the version of the e2TP message format. The version of thisspecification is 10h. The other values than that of the format are those specified when the specification
version is 10h.
DestID and SrcID are the identifiers that indicate the destination and transmitting source of a message,
respectively. The messaging library delivers the message to its destination according to this SrcID.
The TENeT messages specified in the "TENeT Message Specification" are input to the DATA section. TheIC card discriminates a message according to it type, and applies processing to the DATA, which is thecontent of the message.
The thread ID, message types and eTRON ID will be explained in detail in the following subsections.
Table 2. e2TP message format
Description

Size

Meaning(Bytes)
FormatFormat4

Indicates the version of the e2TP message format.
Leading 1B: Specification version (10h)Remaining 3B: Reserved area (000000h)

DestID

Destination eTRON ID

16eTRON ID of the destination of the message.

SrcIDTransmitting eTRON ID

16eTRON ID of the transmitting source of the message.

ThreadID

Thread ID

20ID indicative of the relation of the message.

MessageType

Message type2Type of message defined in each specification

LEN

Data length2

Data length of the message to which a routing header
is assigned.

DATA

2.1.1

DataLEN

TENeT messageeTRON ID

eTRON ID is a 16-byte identifier defined in eTRON/16. The TENeT divides this eTRON ID into theformer 12 bytes of "domain" and the latter 4 bytes of "port."
Each IC card on the TENeT is possessed by a proper domain. The IC card has port=0 as its own value, andtherefore, the eTRON ID of the IC card is "domain|0."
A port is dispensed by the IC card uniquely at the request of an application. The application acquires, as its
own identifier, "domain|port," which is a value consisting of a domain and port coupled. Because it isinefficient, from the viewpoint of system operation, for each application added to or deleted from a mobile
terminal to possess its proper eTRON ID, a unique identifier is assigned to the application when such an ID isrequired, by way of operational solution.
Since ports are "expendable," there is the concern that ports may not be able to be dispensed any longer
some day. However, approximately 4 billion ports can be assigned per domain. That is, it will take some 136
years to exhaust the ports, even if one ID is dispensed every second. Ports are practically inexhaustible.

Copyright © 2005 by T-Engine Forum. All rights served.
3

TEF950-S003-01.00.00/en

2.1.2

Message types

The message type consists of a 2-byte value that classifies the TENeT messages specified in the "TENeT
Message Specification." As for the breakdown of the message type, the higher one byte is a majorclassification that indicates a basic/exchange message, and the lower one byte, a minor classification
indicating the message of the basic/exchange message. Details on each classification are given in Table 3 andTable 4, respectively.
Especially, the minor classification of messages among the basic/exchange messages classifies them into
normal messages and error messages by the MSB of the lower one byte, and into TENeT messages by thedigits of b6 on.
Table 3. Classification by higher one byte of message type
Major classification

b7TENeT message specification

0xxxxxxx-Basic0000000000hExchange

0000000

101hxxxxx-(RFU)

0Arbitrary

1b6b5b4b3b2b1b0

16 Hexadecimal notation(Other digits)xx-* When the MSB is 1, the message type can be used arbitrarily by AP.
Table 4. Classification by lower one byte of message type (Normal/error)
Major classification

b7b6b5b4b3b2b1b0

Normal message

0xxxxxxx

Error message

1xxxxxxx* When the MSB is 0, the message type is used for a normal message.
* When the MSB is 1, the message type is used for an error message.
2.1.3

Thread ID

The applications and IC cards establish correspondence in a series of e2TP messages they input and output
by means of a thread ID.
The thread ID is a value created by an application. When an application requests an operation from an IC
card, a thread ID is assigned as an ID to identify that request uniquely. Since this thread ID is required to be
unique only on an individual application basis, the application takes, as a thread ID, the value resulting fromcoupling the identifier 'serial,' which is unique for each operation request, to its own ID, namely,"domain|port|serial."
Take a file-creating message sent from an application to an IC card, for example. By assigning the same
thread ID to the file-creating message and the response message to be returned from the IC card, theapplication can secure correspondence between the sending of the message and the response.
Moreover, in an exchange control, if an application instructs an IC card to switch, messages areinterchanged several times between the application and the IC card. If all the messages are given the same
thread ID, as in the case described above, the application can identify them as a series of related messages.

Copyright © 2005 by T-Engine Forum. All rights served.
4

TEF950-S003-01.00.00/en

3. Mapping to ISO7816-4 APDUThis section explains the method for mapping the e2TP messages defined in Section 2 to the APDU format,
which is an IC card input/output format.

3.1 APDU format
ISO7816-4 is established as the international standard specification for IC card hardware and messageformats [ISO7816-4]. IC cards conforming to this ISO7816-4 standard accepts only the messages compliant
with the APDU (Application Protocol Data Unit) format. Figure 1 shows the APDU format. The values ofCLA and INS classify the common commands specified in ISO7816-4. P1 and P2 are the parameters used by
the common commands.
HeaderBody

CLAINS

P1

P2

Lc

Data

Le

(1B)

(1B)

(1B)

(1B)

(1B)

(Variable length)(1B)

Figure 1. APDU format

e2TP messages are made in the format defined by an original specification that does not conform to theISO7816-4 standard. For interchange with IC cards, therefore, the TENeT employs the ISO7816-4 Envelope,so that IC cards conforming to ISO7816-4 can accept e2TP messages. The routing header values specified inISO7816-4 are assigned to the Envelope command/response. Therefore, it results that the format contains thee2TP message specified in Subsection 2.1 inside the DATA of the Body section. (See Figure 2.)

3.2 TENeT command format
Figure 2 shows the ISO7816-4 Envelope command format mentioned in Subsection 3.1. The e2TP message
is accommodated in the Body section of the APDU format. Table 5 gives the prescribed values of theEnvelope command.
HeaderBody

CLAINS

P1P2Lc

Data

Le

(1B)

(1B)

(1B)

(1B)

(3B)

(Variable length)(2B)

C-APDU shall always be
the Case 4 extension.

MessageRoutingHeader
FORMAT

DestID

SrcID

(4B)

(16B)

(16B)

PayloadThreadID

Message

LEN

DATA

(20B)

Type(2B)(2B)(Variable length)

Figure 2. Command format
Table 5. Prescribed values of command format
Parameter

Value

CLA

00h (Fixed value)INSC2h (Fixed value)

P100h (Fixed value)

P200h (Fixed value)

Lc

Length of "Data" section inside the Body

Data

e2TP message

Copyright © 2005 by T-Engine Forum. All rights served.
5

TEF950-S003-01.00.00/en
Le0000h (Fixed value)

3.3 TENeT response formats
The format of the response that is output by an IC card after processing an Envelope command is discussed
here. The response varies depending on whether the message has been processed normally, or the value of theHeader section of the APDU command was illegal. The respective response formats are shown below.

3.3.1

On a normal processingFigure 4 illustrates the normal response format. Table 6 shows the prescribed values of SW1 and SW2, theparameters.
Body

TrailerData

SW 1SW 2(Variable length)

(1B)

(1B)

MessageRoutingHeader

PayloadFORMAT

DestID

SrcID

ThreadID

Message

LEN

DATA

(4B)

(16B)

(16B)

(20B)

Type(2B)(2B)(Variable length)

Figure 4. Response format (on a normal end)
Table 6. Prescribed values of response format
Parameter

3.3.2

Value

Data

TENeT message

SW190h (Fixed value)

SW200h (Fixed value)

On an abnormal endFigure 5 illustrates the format of the response issued when the processing ends abnormally due to an illegalrouting header, such as mismatch between the Envelope command header or Lc and Le, and so on. Table 7
shows the prescribed values of SW1 and SW2, the parameters.
Trailer
SW 1

SW 2(1B)(1B)

Figure 5. Response format (on an abnormal end)
Table 7. Prescribed values at the time of abnormal end
Value

Reference

LEN,Lc,Le errors

Description

6700h

The value of LEN, Lc or Le is illegal.

Command execution condition is not met.

6985hPersonalize incomplete

CLA error

6E00h

CLA of C-APDU is illegal.

INS error

6D00h

INS of C-APDU is illegal.

P1-P2 error

6A86h

P1 or P2 of C-APDU is illegal.

Ver error

6AA0h

Version of routing header is illegal.

SrcID error

6AA1h

SrcID of routing header is illegal.

DestID error

6AA2h

DestID of routing header is illegal.

LEN error

6AA3h

LEN of routing header is illegal.

Copyright © 2005 by T-Engine Forum. All rights served.
6TEF950-S003-01.00.00/en(TBD)

3.3.3(TBD)(TBD)

Response format containing multiple messages

The TENeT sometimes sends the result of a processing to multiple remote parties simultaneously. In thiscase, multiple messages are first coupled together, and then, output to the Body section of the response
message, as shown in Figure 6. The multiple messages that are output in this format do not necessarily arriveat the remote parties in the same order as they are accommodated in it.
This format can only be used for output from IC cards, being inhibited for the inputs of messages fromapplications to IC cards.
BodyTrailer

Data

SW 1

SW 2

(Variable length)

(1B)

(1B)

Message 1
RoutingHeader

Message 2

PayloadRoutingHeader

PayloadFigure 6. Response format containing multiple messages

Copyright © 2005 by T-Engine Forum. All rights served.
7

TEF950-S003-01.00.00/en[Bibliography]"TENeT Message Specifications, T-Engine Forum, 2005."

Copyright © 2005 by T-Engine Forum. All rights served.
8