Universal Mobile Telecommunications System (UMTS); LTE; C-language binding to (U)SIM API (3GPP TS 31.131 version 15.0.0 Release 15)

RTS/TSGC-0631131vf00

General Information

Status
Published
Publication Date
15-Apr-2019
Current Stage
12 - Completion
Completion Date
16-Apr-2019
Ref Project
Standard
ETSI TS 131 131 V15.0.0 (2019-04) - Universal Mobile Telecommunications System (UMTS); LTE; C-language binding to (U)SIM API (3GPP TS 31.131 version 15.0.0 Release 15)
English language
58 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)


TECHNICAL SPECIFICATION
Universal Mobile Telecommunications System (UMTS);
LTE;
C-language binding to (U)SIM API
(3GPP TS 31.131 version 15.0.0 Release 15)

3GPP TS 31.131 version 15.0.0 Release 15 1 ETSI TS 131 131 V15.0.0 (2019-04)

Reference
RTS/TSGC-0631131vf00
Keywords
LTE,UMTS
ETSI
650 Route des Lucioles
F-06921 Sophia Antipolis Cedex - FRANCE

Tel.: +33 4 92 94 42 00  Fax: +33 4 93 65 47 16

Siret N° 348 623 562 00017 - NAF 742 C
Association à but non lucratif enregistrée à la
Sous-Préfecture de Grasse (06) N° 7803/88

Important notice
The present document can be downloaded from:
http://www.etsi.org/standards-search
The present document may be made available in electronic versions and/or in print. The content of any electronic and/or
print versions of the present document shall not be modified without the prior written authorization of ETSI. In case of any
existing or perceived difference in contents between such versions and/or in print, the prevailing version of an ETSI
deliverable is the one made publicly available in PDF format at www.etsi.org/deliver.
Users of the present document should be aware that the document may be subject to revision or change of status.
Information on the current status of this and other ETSI documents is available at
https://portal.etsi.org/TB/ETSIDeliverableStatus.aspx
If you find errors in the present document, please send your comment to one of the following services:
https://portal.etsi.org/People/CommiteeSupportStaff.aspx
Copyright Notification
No part may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying
and microfilm except as authorized by written permission of ETSI.
The content of the PDF version shall not be modified without the written authorization of ETSI.
The copyright and the foregoing restriction extend to reproduction in all media.

© ETSI 2019.
All rights reserved.
TM TM TM
DECT , PLUGTESTS , UMTS and the ETSI logo are trademarks of ETSI registered for the benefit of its Members.
TM TM
3GPP and LTE are trademarks of ETSI registered for the benefit of its Members and
of the 3GPP Organizational Partners.
oneM2M™ logo is a trademark of ETSI registered for the benefit of its Members and
of the oneM2M Partners. ®
GSM and the GSM logo are trademarks registered and owned by the GSM Association.
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 2 ETSI TS 131 131 V15.0.0 (2019-04)
Intellectual Property Rights
Essential patents
IPRs essential or potentially essential to normative deliverables may have been declared to ETSI. The information
pertaining to these essential IPRs, if any, is publicly available for ETSI members and non-members, and can be found
in ETSI SR 000 314: "Intellectual Property Rights (IPRs); Essential, or potentially Essential, IPRs notified to ETSI in
respect of ETSI standards", which is available from the ETSI Secretariat. Latest updates are available on the ETSI Web
server (https://ipr.etsi.org/).
Pursuant to the ETSI IPR Policy, no investigation, including IPR searches, has been carried out by ETSI. No guarantee
can be given as to the existence of other IPRs not referenced in ETSI SR 000 314 (or the updates on the ETSI Web
server) which are, or may be, or may become, essential to the present document.
Trademarks
The present document may include trademarks and/or tradenames which are asserted and/or registered by their owners.
ETSI claims no ownership of these except for any which are indicated as being the property of ETSI, and conveys no
right to use or reproduce any trademark and/or tradename. Mention of those trademarks in the present document does
not constitute an endorsement by ETSI of products, services or organizations associated with those trademarks.
Foreword
This Technical Specification (TS) has been produced by ETSI 3rd Generation Partnership Project (3GPP).
The present document may refer to technical specifications or reports using their 3GPP identities, UMTS identities or
GSM identities. These should be interpreted as being references to the corresponding ETSI deliverables.
The cross reference between GSM, UMTS, 3GPP and ETSI identities can be found under
http://webapp.etsi.org/key/queryform.asp.
Modal verbs terminology
In the present document "shall", "shall not", "should", "should not", "may", "need not", "will", "will not", "can" and
"cannot" are to be interpreted as described in clause 3.2 of the ETSI Drafting Rules (Verbal forms for the expression of
provisions).
"must" and "must not" are NOT allowed in ETSI deliverables except when used in direct citation.
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 3 ETSI TS 131 131 V15.0.0 (2019-04)
Contents
Intellectual Property Rights . 2
Foreword . 2
Modal verbs terminology . 2
Foreword . 6
1 Scope . 7
2 References . 7
3 Definitions and abbreviations . 8
3.1 Definitions . 8
3.2 Abbreviations . 8
4 Description . 9
4.1 Overview . 9
4.2 Design Rationale and Upward Compatibility . 9
4.3 Application Triggering . 10
4.4 Proactive command handling . 13
4.5 Application Loading . 13
5 'C'-language binding for (U)SIM API . 13
5.1 Overview . 13
5.2 Toolkit Application Functions . 14
5.2.1 main . 14
5.2.2 CatGetFrameworkEvent . 15
5.2.3 CatExit . 15
5.3 Registry . 16
5.3.1 CatSetMenuString . 16
5.3.2 CatNotifyOnFrameworkEvent . 16
5.3.3 CatNotifyOnEnvelope . 17
5.3.4 CatNotifyOnEvent . 17
5.4 Man-Machine Interface . 17
5.4.1 CatAddItem. 17
5.4.2 CatSelectItem . 17
5.4.3 CatEndSelectItem . 18
5.4.4 CatDisplayText . 18
5.4.5 CatGetInKey . 18
5.4.6 CatGetInput. 19
5.4.7 CatSetupIdleModeText . 19
5.4.8 CatPlayTone . 20
5.5 Timers . 20
5.5.1 CatGetTimer . 20
5.5.2 CatFreeTimer . 20
5.5.3 CatStartTimer . 20
5.5.4 CatGetTimerValue . 21
5.6 Supplementary Card Reader Management . 21
5.6.1 CatPowerOnCard . 21
5.6.2 CatPowerOffCard . 21
5.6.3 CatPerformCardAPDU . 21
5.6.4 CatGetReaderStatus . 22
5.7 UICC File Store Access . 22
5.7.1 CatSelect . 22
5.7.2 CatStatus . 22
5.7.3 CatGetCHVStatus . 23
5.7.4 CatReadBinary . 23
5.7.5 CatUpdateBinary . 23
5.7.6 CatReadRecord . 23
5.7.7 CatUpdateRecord . 24
5.7.8 CatSearch . 24
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 4 ETSI TS 131 131 V15.0.0 (2019-04)
5.7.9 CatIncrease . 24
5.7.10 CatInvalidate . 25
5.7.11 CatRehabilitate . 25
5.8 Miscellaneous . 25
5.8.1 CatGetTerminalProfile . 25
5.8.2 CatMoreTime . 25
5.8.3 CatPollingOff . 25
5.8.4 CatPollInterval . 26
5.8.5 CatRefresh . 26
5.8.6 CatLanguageNotification . 26
5.8.7 CatLaunchBrowser . 26
5.9 Low-level Interface . 27
5.9.1 CatResetBuffer . 28
5.9.2 CatStartProactiveCommand . 28
5.9.3 CatSendProactiveCommand . 28
5.9.4 CatOpenEnvelope . 28
5.9.5 CatSendEnvelopeResponse . 28
5.9.6 CatSendEnvelopeErrorResponse . 29
5.9.7 CatPutData . 29
5.9.8 CatPutByte . 29
5.9.9 CatPutTLV . 29
5.9.10 CatPutBytePrefixedTLV . 29
5.9.11 CatPutOneByteTLV. 29
5.9.12 CatPutTwoByteTLV . 30
5.9.13 CatGetByte . 30
5.9.14 CatGetData . 30
5.9.15 CatFindNthTLV . 30
5.9.16 CatFindNthTLVInUserBuffer. 30
5.10 Network Services . 31
5.10.1 CatGetLocationInformation . 31
5.10.2 CatGetTimingAdvance . 31
5.10.3 CatGetIMEI . 31
5.10.4 CatGetNetworkMeasurementResults . 31
5.10.5 CatGetDateTimeAndTimeZone . 32
5.10.6 CatGetLanguage . 32
5.10.7 CatSetupCall . 32
5.10.8 CatSendShortMessage . 33
5.10.9 CatSendSS . 34
5.10.10 CatSendUSSD . 34
5.10.11 CatOpenCSChannel . 35
5.10.12 CatOpenGPRSChannel . 36
5.10.13 CatCloseChannel . 38
5.10.14 CatReceiveData . 38
5.10.15 CatSendData . 38
5.10.16 CatGetChannelStatus . 39
5.10.17 CatServiceSearch . 39
5.10.18 CatGetServiceInformation . 39
5.10.19 CatDeclareService . 40
5.10.20 CatRunATCommand . 40
5.10.21 CatSendDTMFCommand . 40
5.11 Supporting Data Types . 41
5.11.1 CatRecordAccessMode . 41
5.11.2 CatSearchMode . 41
5.11.3 CatFrameworkEventType . 41
5.11.4 CatEnvelopeTagType . 42
5.11.5 CatEventType . 42
5.11.6 CatTextString . 42
5.11.7 CatAlphaString . 42
5.11.8 CatIconIdentifier . 42
5.11.9 CatIconOption . 43
5.11.10 CatDCSValue . 43
5.11.11 CatDisplayTextOptions . 43
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 5 ETSI TS 131 131 V15.0.0 (2019-04)
5.11.12 CatGetInKeyOptions . 43
5.11.13 CatGetInputOptions . 43
5.11.14 CatSelectItemOptions . 44
5.11.15 CatTimeUnit . 44
5.11.16 CatTone . 44
5.11.17 CatRefreshOptions . 44
5.11.18 CatGetReaderStatusOptions . 44
5.11.19 CatDevice . 45
5.11.20 CatGeneralResult . 45
5.11.21 CatTimerValue . 46
5.11.22 CatTimeInterval . 46
5.11.23 CatFileStatus . 46
5.11.24 CatLanguageNotificationOptions . 47
5.11.25 CatLocationInformation . 47
5.11.26 CatTimingAdvance . 47
5.11.27 CatLaunchBrowserOptions . 47
5.11.28 CatSetupCallOptions . 47
5.11.29 CatTypeOfNumberAndNumberingPlanIdentifier . 48
5.11.30 CatSendShortMessageOptions . 48
5.11.31 CatSendDataOptions . 48
5.11.32 CatMEInterfaceTransportLevelType . 49
5.11.33 CatBearer . 49
5.11.34 CatOpenChannelOptions . 49
5.11.35 CatAddressType . 49
5.11.36 CatFID . 49
5.11.37 CatTextFormat . 50
5.11.38 CatTextForegroundColour . 50
5.11.39 CatTextBackgroundColour . 50
Annex A (normative): Application executable architecture . 51
Annex B (informative): Example . 54
Annex C (informative): Change history . 56
History . 57

ETSI
3GPP TS 31.131 version 15.0.0 Release 15 6 ETSI TS 131 131 V15.0.0 (2019-04)
Foreword
rd
This Technical Specification has been produced by the 3 Generation Partnership Project (3GPP).
The contents of the present document are subject to continuing work within the TSG and may change following formal
TSG approval. Should the TSG modify the contents of the present document, it will be re-released by the TSG with an
identifying change of release date and an increase in version number as follows:
Version x.y.z
where:
x the first digit:
1 presented to TSG for information;
2 presented to TSG for approval;
3 or greater indicates TSG approved document under change control.
y the second digit is incremented for all changes of substance, i.e. technical enhancements, corrections,
updates, etc.
z the third digit is incremented when editorial only changes have been incorporated in the document.
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 7 ETSI TS 131 131 V15.0.0 (2019-04)
1 Scope
A Subscriber Identity Module Application Programming Interface (SIM API) has been defined in TS 42.019 [4] as a
technology-independent API by which toolkit applications and (U)SIMs co-operate. That specification is independent
of the programming language technology used to create the application, the platform used to host the application and
the runtime environment used to execute the application.
The present document includes information applicable to (U)SIM toolkit application developers creating applications
using the C programming language ISO/IEC 9899 [7]. The present document describes an interface between toolkit
applications written in the C programming language and the (U)SIM in order to realize the co-operation set forth in
TS 42.019 [4]. In particular, the API described herein provides the service of assembling proactive commands and
disassembling the responses to these commands for the application programmer.
Software tools, integrated software development environments and software management systems that may be used to
create application programs are explicitly out of scope of the present document.
2 References
The following documents contain provisions which, through reference in this text, constitute provisions of the present
document.
• References are either specific (identified by date of publication, edition number, version number, etc.) or
non-specific.
• For a specific reference, subsequent revisions do not apply.
• For a non-specific reference, the latest version applies. In the case of a reference to a 3GPP document (including
a GSM document), a non-specific reference implicitly refers to the latest version of that document in the same
Release as the present document.
[1] 3GPP TR 21.905: "Vocabulary for 3GPP Specifications".
[2] 3GPP TS 31.111: "USIM Application Toolkit (USAT)".
[3] 3GPP TS 23.048: "Security Mechanisms for the (U)SIM application toolkit; Stage 2".
[4] 3GPP TS 42.019: "Subscriber Identity Module Application Programming Interface (SIM API);
Stage 1".
[5] ISO 639 (1988): "Code for the representation of names of languages".
[6] 3GPP TS 23.038: "Alphabets and language-specific information".
[7] ISO/IEC 9899: "Programming Languages - C".
[8] 3GPP TS 11.14: "Specification of the SIM Application Toolkit for the Subscriber Identity Module
- Mobile Equipment (SIM – ME) interface".
[9] Tool Interface Standard (TIS) Executable and Linking Format Specification Version 1.2.
[10] SYSTEM V Application Binary Interface, Edition 4.1.
[11] 3GPP TS 51.011: "Specification of the Subscriber Identity Module - Mobile Equipment (SIM-ME)
interface".
[12] Void.
[13] 3GPP TS 31.115: "Secured packet structure for (U)SIM Toolkit applications".
[14] 3GPP TS 31.116: "Remote APDU Structure for (U)SIM Toolkit applications".
[15] 3GPP TS 31.102: "Characteristics of the USIM Application".
[16] 3GPP TS 31.101: "UICC-Terminal Interface, Physical and Logical Characteristics".
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 8 ETSI TS 131 131 V15.0.0 (2019-04)
3 Definitions and abbreviations
3.1 Definitions
For the purposes of the present document, the following terms and definitions apply:
application: computer program that defines and implements a useful domain-specific functionality
The term may apply to the functionality itself, to the representation of the functionality in a programming language, or
to the realization of the functionality as executable code.
application executable: representation of an application as collection of executable codes
application program: representation of an application in a programming language such as assembly language, C, Java,
WML or XHTML
Application Programming Interface (API): collection of entry points and data structures that an application program
can access when translated into an application executable
byte code: processor-independent representation of a basic computer operation such as "increment by one" that is
executed by computer program called a byte code interpreter
data structure: memory address that can be accessed by an application executable in order to read or write data
entry point: memory address that can be branched to by an application executable in order to access functionality
defined by an application-programming interface
Depending on the software technology, an entry point is also called a subroutine, a function or a method.
executable code: generic term for either byte code or native code
framework: defines a set of Application Programming Interface (API) functions for developing applications and for
providing system services to those applications
loadfile: representation of an application executable that is transmitted from the terminal to the smart card operating
system
A loadfile typically includes information about the application executable in addition to the application executable
itself.
native code: processor-dependent representation of a basic computer operation such as "increment by one" that is
executed by the hardware circuitry of a computer's central processing unit
toolkit application: uses the commands described in TS 31.111 [2] and TS 11.14 [8]
3.2 Abbreviations
For the purpose of the present document, the following abbreviations apply:
APDU Application Protocol Data Unit
API Application Programming Interface
CAT Card Application Toolkit
CS Circuit Switched
DCS Digital Cellular System
DF Dedicated File
DTMF Dual Tone Multiple Frequency
EF Elementary File
ELF Executable and Linkable Format
FID File Identifier
GSM Global System for Mobile communications
ME Mobile Equipment
NAA Network Access Application (SIM or USIM)
OTA Over The Air
SIM Subscriber Identity Module
SMS Short Message Service
STK SIM ToolKit
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 9 ETSI TS 131 131 V15.0.0 (2019-04)
SW Status Word
TAR Toolkit Application Reference
TLV Tag, Length, Value
TPDU Transport Protocol Data Unit
UICC (not an acronym)
URL Uniform Resource Locator
USIM Universal Subscriber Identity Module
USSD Unstructured Supplementary Services Data
4 Description
The (U)SIM Application consists of the following:
- APDU handlers for communicating with the ME;
- File system and file access control;
- Toolkit Framework that provides services to Toolkit applications.
The present document describes the C programming language binding for the interface between the (U)SIM application
and toolkit applications described in TS 42.019 [4]. This API allows application programmers using the C programming
language to access functions and data described in TS 31.111 [2] and TS 11.14 [8], such that the (U)SIM-based
applications and the services they implement can be developed and loaded onto ICCs. If required and supported by the
underlying smart card technology, toolkit applications can be loaded or deleted remotely, after the card has been issued.
4.1 Overview
The 'C'-binding for (U)SIM API shall provide function calls for pro-active functions and transport functions. The figure
below shows the interactions between a typical toolkit application (shown in blue) and the various functional blocks of
the (U)SIM (shown in orange). The C-bindings for these APIs are presented in subclause 4.2.
Load/delete Toolkit
Application 03.48
Create new Toolkit
application from SMS-PP
New Toolkit
Registry
application
Registered
Toolkit application
Toolkit
event
Toolkit
APDU information
event
APDU or install
application Update
handler
Information
triggering
Request
Registry handler
Mobile
Equipment 91 xx
Proactive File access
Proactive command
Fetch command Toolkit
command Request
application NAA
handler
file
Proactive command
File data access
Terminal
response data
Proactive
Terminal response Allowed Access/
File data
response
Command
handler
NAA File system
Response data
Envelope response
handler
Figure 1
4.2 Design Rationale and Upward Compatibility
Some functions on the C SIM API take parameters that correspond to optional TLVs in TS 31.111 [2] and TS 11.14 [8].
If the actual parameter value passed to the function is NULL, the corresponding TLV is not passed to the ME; an
example of an optional parameter is CatIconIdentifier that corresponds to the ICON IDENTIFIER TLV.
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 10 ETSI TS 131 131 V15.0.0 (2019-04)
Some proactive commands have a very large number of optional TLVs, such as SETUP CALL. Therefore, this API
offers two variants that address this aspect, CatSetupCall and CatSetupCallEx. The first function, CatSetupCall, takes
as parameters everything that is necessary to issue a successful SETUP CALL proactive command (i.e. everything
required to construct the mandatory TLVs as required by TS 31.111 [2] and TS 11.14 [8]) and also includes optional
user interface TLVs (title and icon) for ease of use.
The second function, CatSetupCallEx, takes a parameter block that can be extended in future versions of the present
specification. The parameter block contains members that correspond to all mandatory and optional TLVs for the
SETUP CALL proactive command.
The reason for introducing the "…Ex" variants is threefold:
- Rather than extend the parameter list of a function to take a large number of optional parameters for each call, it
is preferable to set up the parameters using named structure members before issuing the call to the function.
- If a future version of TS 31.111 [2] or TS 11.14 [8] extends the optional parameters for a proactive command,
the corresponding parameter block can be extended to encompass these parameters without changing the
function prototype.
- Any source code written for an older version of this C SIM API can be recompiled with a later version without
change and will remain upwardly compatible at the source as long as the suggested coding standards are adhered
to.
4.3 Application Triggering
The application-triggering portion of the SIM Toolkit Framework is responsible for the activation of toolkit
applications, based on the APDU received by the card.
The ME shall not be adversely affected by the presence of applications on the (U)ICC card. For instance a syntactically
correct Envelope shall not result in an error status word in case of a failure of an application. The only application as
seen by the ME is the (U)SIM application. As a result, a toolkit application may return an error, but this error will not
be sent to the ME.
The difference between an application and a toolkit application is that a toolkit application does not typically handle
APDUs directly. It will handle higher-level messages. Furthermore the execution of a function could span over multiple
APDUs, in particular, the proactive protocol commands.
All the applications that have registered interest in the event are triggered in order of their priority.
- The current context is switched to the toolkit application.
- A pending transaction is aborted.
- The current file context of the toolkit application is the MF.
- The current file context of the current selected application is unchanged.
On termination of a toolkit application execution of CatExit():
- The context switches back to the context of the current selected application, the NAA application.
- A pending toolkit application transaction is aborted.
Here after are the events that can trigger a toolkit application:
EVENT_PROFILE_DOWNLOAD
Upon reception of the Terminal Profile command by the (U)SIM, the Toolkit Framework stores the ME profile and then
triggers the registered toolkit application that may want to change their registry. A toolkit application may not be able to
issue a proactive command.
EVENT_MENU_SELECTION, EVENT_MENU_SELECTION_HELP_REQUEST
A toolkit application might be activated upon selection in the ME's menu by the user, or request help on this specific
menu.
ETSI
3GPP TS 31.131 version 15.0.0 Release 15 11 ETSI TS 131 131 V15.0.0 (2019-04)
In order to allow the user to choose in a menu, the Toolkit Framework shall have previously issued a SET UP MENU
proactive command. When a toolkit application changes a menu entry of its registry object, the Toolkit Framework shall
dynamically update the menu stored in the ME during the current card session. The SIM Toolkit Framework shall use
the data of the EFsume file (TS 51.011 [11] and TS 31.102 [15]) when issuing the SET UP MENU proactive command.
The positions of the toolkit application menu entries in the item list, the requested item identifiers and the associated
limits (e.g. maximum length of item text string) are defined at the loading of the toolkit application.
If at least one toolkit application registers to EVENT_MENU_SELECTION_HELP_REQUEST, the SET UP MENU
proactive command sent by the Toolkit Framework shall indicate to the ME that help information is available. A toolkit
application registered for one or more menu entries may be triggered by the event
EVENT_MENU_SELECTION_HELP_REQUEST, even if it is not registered to this event. A toolkit application
registered for one or more menu entries should provide help information.
EVENT_FORMATTED_SMS_PP_ENV, EVENT_UNFORMATTED_SMS_PP_ENV,
EVENT_FORMATTED_SMS_PP_UPD, EVENT_UNFORMATTED_SMS_PP_UPD
A toolkit application can be activated upon the reception of a short message. There are two ways for a card to receive an
SMS: via the Envelope SMS-PP Data Download or the UpdateRecord EFsms instruction.
The reception of the SMS by the toolkit application cannot be guaranteed for the Update Record EFsms instruction.
The received SMS may be:
- formatted according to TS 23.048 [3] or an other protocol to identify explicitly the toolkit application for which
the message is sent;
- unformatted or using a toolkit application specific protocol the Toolkit Framework will pass this data to all
registered toolkit applications.
EVENT_FORMATTED_SMS_PP_ENV
This event is triggered by an envelope APDU containing an SMS_DATADOWNLOAD BER TLV with an
SMS_TPDU simple TLV according to TS 23.048 [3].
The Toolkit Framework shall:
- verify the TS 23.048 [3] security of the SMS TPDU;
- trigger the toolkit application registered with the corresponding TAR defined at application loading;
- take the optional Application Data posted by the triggered toolkit application
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...