WO2008148278A1 - Method for exchanging large-capacity data between mobile terminal and smart card - Google Patents

Method for exchanging large-capacity data between mobile terminal and smart card Download PDF

Info

Publication number
WO2008148278A1
WO2008148278A1 PCT/CN2007/070890 CN2007070890W WO2008148278A1 WO 2008148278 A1 WO2008148278 A1 WO 2008148278A1 CN 2007070890 W CN2007070890 W CN 2007070890W WO 2008148278 A1 WO2008148278 A1 WO 2008148278A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
mobile terminal
smart card
block
command
Prior art date
Application number
PCT/CN2007/070890
Other languages
French (fr)
Chinese (zh)
Inventor
Zhengquan Huang
Yanhui Yang
Su Zhang
Zhiyong Pan
Original Assignee
Phoenix Microelectronics (China) Co., Ltd.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Phoenix Microelectronics (China) Co., Ltd. filed Critical Phoenix Microelectronics (China) Co., Ltd.
Publication of WO2008148278A1 publication Critical patent/WO2008148278A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/18Processing of user or subscriber data, e.g. subscribed services, user preferences or user profiles; Transfer of user or subscriber data
    • H04W8/20Transfer of user or subscriber data
    • H04W8/205Transfer to or from user equipment or user record carrier

Definitions

  • the method for the mobile terminal to access the data in the smart card is as shown in FIG. 1.
  • the communication between the mobile terminal and the smart card is completely completed by the baseband processor of the mobile terminal, and the underlying physical transmission channel conforms to ISO/IEC 7816-3. -4 standard.
  • the technical problem to be solved by the present invention is to provide a large-capacity data exchange method between a mobile terminal and a smart card, which enables the mobile terminal application to directly exchange large-capacity data with the smart card, and further ensures the integrity and validity of the data transmission.
  • the standard is the ISO/IEC 7816 standard, which specifies that the maximum transmission data per APDU may be 256 bytes or 64 kbytes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephonic Communication Services (AREA)

Abstract

A method for exchanging the large-capacity data between the mobile terminal and the smart card comprises: establishing the transmission channel between the mobile terminal and the smart card by using the APDU command, establishing the special logical channel by using the protocol token corresponding to the mobile terminal application and the file of smart card, and transmitting the large-capacity data that the blocking size meets the standard ordain. The problem of transmitting the large-capacity data by using the standard ISO/IEC 7816 interface is settled by this method.

Description

一种移动终端与智能卡之间的大容量数据交换方法 技术领域  Large-capacity data exchange method between mobile terminal and smart card
本发明涉及移动终端与智能卡应用, 具体涉及一种移动终端与智能卡之 间的大容量数据交换方法。  The present invention relates to a mobile terminal and a smart card application, and in particular to a large-capacity data exchange method between a mobile terminal and a smart card.
背景技术 Background technique
( )随着无线通信技术的飞速发展和广泛应用, 各种各样的移动增值业务 / 应用相继出现。 其中比较典型的有两类: 基于移动终端的应用和基于智能卡 的应用。 前者虽得到了一定程度的发展, 但由于很少受运营商的监管, 因此 得不到运营商的大力支持; 而基于智能卡的应用, 由于其集成在智能卡内, 完全受运营商的监控, 因此, 比基于移动终端的应用更容易得到运营商的支 持, 从而得到大面积的推广。  ( ) With the rapid development and wide application of wireless communication technologies, various mobile value-added services/applications have emerged. There are two typical types: mobile terminal-based applications and smart card-based applications. Although the former has developed to a certain extent, it is rarely supported by operators, so it is not supported by operators. The smart card-based application is completely monitored by operators because it is integrated in the smart card. It is easier to get support from operators than mobile terminal-based applications, and thus it can be widely promoted.
但是, 由于受到包括智能卡的处理能力、 通信手段和容量在内的诸多技 术条件的限制, 导致目前基于智能卡的应用只能提供功能简单、 模式单一的 应用, 典型的如: SIM卡应用工具箱 (SIM Application Toolkit, 简称 SAT或 STK ) , 只能提供纯文字菜单式的显示。 这与基于移动终端的应用发展形成 了很大反差, 与整个移动通信行业的飞速发展脱节。  However, due to the limitations of many technical conditions including the processing power, communication means and capacity of the smart card, the current smart card-based application can only provide applications with simple functions and single mode, such as: SIM card application toolbox ( The SIM Application Toolkit (referred to as SAT or STK) can only provide a plain text menu display. This is in sharp contrast to the development of mobile terminal-based applications and is out of sync with the rapid development of the entire mobile communications industry.
针对这种情况, 已经出现多种具有超大容量的智能卡, 其容量通常以兆 字节为单位计, 远大于目前市面上的普通智能卡, 其最大容量为 256k字节。 从而使得在智能卡上开发和部署大量新的应用成为可能。 但由于目前移动终 端与智能卡之间仍然釆用 ISO/IEC 7816以及移动通信的有关协议, 导致其通 信手段和模式仍然单一, 很难满足这些应用的通信要求。  In response to this situation, a variety of smart cards with very large capacity have appeared, and their capacity is usually measured in units of megabytes, which is much larger than the conventional smart cards currently on the market, and the maximum capacity is 256 kbytes. This makes it possible to develop and deploy a large number of new applications on smart cards. However, due to the fact that ISO/IEC 7816 and mobile communication protocols are still used between mobile terminals and smart cards, the communication methods and modes are still single, and it is difficult to meet the communication requirements of these applications.
(二)目前, 移动终端访问智能卡中数据的方法如图 1所示, 移动终端与智 能卡间的通信完全通过移动终端的基带处理器来完成, 其底层物理传输通道 遵循 ISO/IEC 7816-3、 -4标准。  (2) At present, the method for the mobile terminal to access the data in the smart card is as shown in FIG. 1. The communication between the mobile terminal and the smart card is completely completed by the baseband processor of the mobile terminal, and the underlying physical transmission channel conforms to ISO/IEC 7816-3. -4 standard.
(1)在实际操作中, 移动终端上层应用或其它终端, 如个人电脑 PC, 将 AT命令发送给基带处理器, 基带处理器再将其转换成符合 ISO/IEC 7816标 准的应用协议数据单元( Application Protocol Data Unit , 简称 APDU )命令 将其发送给智能卡, 来实现命令的执行和数据的传输。 (1) In actual operation, the upper layer application of the mobile terminal or other terminal, such as a personal computer PC, sends an AT command to the baseband processor, and the baseband processor converts it into an ISO/IEC 7816 standard. The Application Protocol Data Unit (APDU) command sends the command to the smart card to implement command execution and data transmission.
第三代移动伙伴计划技术规范 3GPP TS 07.07规范中定义了适用于移动 终端的 AT命令集。 除了一些针对具体应用的①专用命令外, 如选择电话本 存储空间等, 还有②两条通用 AT命令可用于直接向用户识别模块一 SIM卡 发送 APDU命令。 这两条命令分别是: CSIM和 CRSM。 其中, CSIM是通用 SIM访问命令 ( Generic SIM access ) , 通过此命令移动终端可以向 SIM发送 和返回所有符合 GSM 11.11规范中的 APDU命令; 而 CRSM是受限 SIM访 问命令(Restricted SIM access ) , 只可以传输 GSM11.11规范中指定的六条 命令, 包括读 /更新二进制 READ/UPDATE BINARY , 读 /更新记录 READ/UPDATE RECORD, 取响应 GET RESPONSE, 获取状态 STATUS等。  Third Generation Mobile Partner Program Technical Specification The AT command set for mobile terminals is defined in the 3GPP TS 07.07 specification. In addition to some dedicated commands for specific applications, such as selecting a phonebook storage space, there are two general AT commands that can be used to send APDU commands directly to the subscriber identity module, a SIM card. The two commands are: CSIM and CRSM. The CSIM is a generic SIM access command (Generic SIM access), by which the mobile terminal can send and return all APDU commands in accordance with the GSM 11.11 specification to the SIM; and the CRSM is a restricted SIM access command (Restricted SIM access). It can transfer six commands specified in the GSM11.11 specification, including read/update binary READ/UPDATE BINARY, read/update record READ/UPDATE RECORD, response GET RESPONSE, get status STATUS, etc.
(2)由于上述直接向智能卡发送 APDU的 AT命令都是可选命令, 并非所 有的基带处理器都提供对它们的支持。 即便提供, 如果移动终端的操作系统 或人机接口 MMI 不对上层应用软件提供相应的应用编程接口 (Application Programming Interface, 简称 API ) , 移动终端的应用软件仍无法使用所述 AT 命令来建立一种统一的、 通用的可以直接访问智能卡内数据的通道。 目前的 实际情况是这两种可能性均存在, 即①有些基带处理器不支持直接向智能卡 发送 APDU的 AT命令, ②有些移动终端操作系统不向上层应用软件开放所 述命令的接口。 基于此, 从通用性和兼容性的角度来看, 移动终端的上层应 用软件不能釆用直接向智能卡发送可选 APDU的 AT命令的方式来访问智能 卡, 只能借助移动终端当前提供的访问智能卡的功能或接口来实现数据 /文件 的传输, 以便在移动终端上建立各种基于智能卡的移动增值应用。  (2) Since the above AT commands for directly transmitting APDUs to smart cards are optional commands, not all baseband processors provide support for them. Even if provided, if the operating system or human interface MMI of the mobile terminal does not provide a corresponding Application Programming Interface (API) for the upper application software, the application software of the mobile terminal cannot use the AT command to establish a unified Universal, universal access to data within the smart card. The current situation is that both possibilities exist. That is, some baseband processors do not support the AT command to send APDUs directly to the smart card. 2 Some mobile terminal operating systems do not open the interface of the command to the upper layer application software. Based on this, from the perspective of versatility and compatibility, the upper layer application software of the mobile terminal cannot access the smart card by directly transmitting the AT command of the optional APDU to the smart card, and can only access the smart card by the mobile terminal currently provided by the mobile terminal. A function or interface to implement data/file transfer to create various smart card-based mobile value-added applications on the mobile terminal.
此外, 由于 APDU命令格式本身的限制, 智能卡文件的最大容量不超过 64k字节, 而 APDU每次传送的数据不超过 256字节或 64K字节, 如此小的 文件容量和数据传输量导致无法在智能卡上实现复杂的应用, 比如图形化的 应用。 因此, 有必要扩展智能卡可以容纳和传输的数据容量, 尤其是要解决 如何利用标准的 ISO/IEC 7816接口来传输大容量数据。  In addition, due to the limitation of the APDU command format itself, the maximum capacity of the smart card file does not exceed 64k bytes, and the data transmitted by the APDU does not exceed 256 bytes or 64K bytes at a time. Such a small file capacity and data transmission amount cannot be caused. Implement complex applications on smart cards, such as graphical applications. Therefore, it is necessary to expand the data capacity that smart cards can accommodate and transmit, especially to address how to transfer large amounts of data using the standard ISO/IEC 7816 interface.
BISO/IEC 7816-4 是主从结构、 命令响应式的协议。 APDU分为命令 APDU和响应 APDU两类。 由主机端向智能卡发出命令 APDU; 智能卡接受 命令 APDU后, 执行命令并返回响应 APDIL BISO/IEC 7816-4 is a master-slave structure, command-responsive protocol. The APDU is classified into two types: command APDU and response APDU. The host sends a command APDU to the smart card; the smart card accepts After the command APDU, execute the command and return the response APDIL
命令 APDU包括一个必备的 4字节的命令头 (CLA、 INS, Pl、 P2 )和 一个可选的可变长度的命令体(Lc、 Data, Le ) , 如下所示:
Figure imgf000005_0001
The command APDU consists of a mandatory 4-byte command header (CLA, INS, Pl, P2) and an optional variable-length command body (Lc, Data, Le) as follows:
Figure imgf000005_0001
命令头为命令的编码, Lc为体内数据 Data的长度; Data为发送的数据; Le是期望应答 APDU数据字段的最大字节数。 当 Le=0时, 表示请求送回最 大应答数据字节数, 如 Le为 1字节长度, 则最大数据字节数为 256。  The command header is the encoding of the command, Lc is the length of the in-vivo data Data; Data is the transmitted data; Le is the maximum number of bytes expected to answer the APDU data field. When Le=0, it indicates that the request returns the maximum number of response data bytes. If Le is 1 byte length, the maximum number of data bytes is 256.
命令 APDU命令头中的各字节的含义为:  The meaning of each byte in the command header of the APDU is:
CLA: 指令类别, GSM11.11规定, OxAO用于 GSM应用;  CLA: Instruction category, GSM 11.11 specifies that OxAO is used for GSM applications;
INS: 指令代码;  INS: instruction code;
Pl、 P2: 指令的参数, Pl、 P2的含义和具体指令相关。  Pl, P2: The parameters of the instruction, the meaning of Pl and P2 are related to the specific instruction.
在 GSM应用中, 对 ISO/IEC 7816-4的命令 APDU格式进行了精简, 其 命令 APDU的格式如下:
Figure imgf000005_0002
In the GSM application, the command APDU format of ISO/IEC 7816-4 has been simplified, and the format of the command APDU is as follows:
Figure imgf000005_0002
其中, P3表示指令中送给 SIM卡的数据长度, 或是表示等待从卡响应的 数据最大长度。  P3 represents the length of the data sent to the SIM card in the command, or the maximum length of the data waiting for the response from the card.
响应 APDU由可变长度的数据体和 2字节尾部组成, 其中数据体可选, 尾部必备, 如下表所示:
Figure imgf000005_0003
The response APDU consists of a variable-length data body and a 2-byte trailer, where the data body is optional and the tail is mandatory, as shown in the following table:
Figure imgf000005_0003
其中, 数据体的字节数由命令 APDU的 Le指出。 Data是接收设备, 如 智能卡,接收命令 APDU并进行处理后送回发送设备, 如接口设备, 的数据。 尾部 SW1和 SW2为状态代码, 各一个字节, 指示命令执行的结果正确与否。  The number of bytes of the data body is indicated by Le of the command APDU. Data is the receiving device, such as a smart card, that receives the command APDU and processes it and sends it back to the sending device, such as the interface device. The tails SW1 and SW2 are status codes, one byte each, indicating whether the result of the command execution is correct or not.
无论是命令 APDU, 还是响应 APDU, 其中的数据体 Data都可用于传输 自定义的数据。 但由于 APDU格式及定义所限, 其长度由 Le、 Lc或 P3来决 定。 Lc、 Le有短型和扩展型两种, 其长度分别为 1个字节和 3个字节, 3个 字节中第一个字节值为 0。 因此,每条 APDU所能传输的数据长度最多为 64k 字节。 而在 GSM协议中 P3的长度固定为 1字节, 意味着每条 APDU所能传 输的数据长度最多为 256字节。 因此, 要传输更大容量的数据, 必须釆用多 条 APDU和 /或多个文件才能实现。 Whether it is a command APDU or a response APDU, the data body Data can be used to transfer customized data. However, due to the APDU format and definition, its length is determined by Le, Lc or P3. Set. Lc and Le have both short and extended types, and their lengths are 1 byte and 3 bytes respectively, and the first byte value of 3 bytes is 0. Therefore, the data length that each APDU can transmit is up to 64k bytes. In the GSM protocol, the length of P3 is fixed to 1 byte, which means that the length of data that can be transmitted by each APDU is up to 256 bytes. Therefore, to transfer larger amounts of data, multiple APDUs and/or multiple files must be used.
在移动通信协议中, 通过状态字节 SW1、 SW2 的值可以自动发送多条 APDU命令。 当 SWl/SW2=0x9FXX时, 移动终端需要发送 GET RESPONSE 命令来获取输出数据。 当釆用 ENVELOPE命令进行智能卡数据下载时,如果 SW1/SW2 = 0x9EXX时, 移动终端同样需要发送 GET RESPONSE命令来获 取响应数据。 在支持主动式命令移动终端中, 当 SWl/SW2=0x91XX 时, 移 动终端需要发送 FETCH命令来获取智能卡需要发送的数据。这样,通过状态 字节, 就可以在移动终端与智能卡之间自动进行多条 APDU命令或大容量数 据的传送。  In the mobile communication protocol, multiple APDU commands can be automatically sent through the values of the status bytes SW1, SW2. When SWl/SW2=0x9FXX, the mobile terminal needs to send a GET RESPONSE command to obtain the output data. When using the ENVELOPE command for smart card data download, if SW1/SW2 = 0x9EXX, the mobile terminal also needs to send a GET RESPONSE command to obtain the response data. In the active command mobile terminal, when SWl/SW2=0x91XX, the mobile terminal needs to send a FETCH command to acquire the data that the smart card needs to send. In this way, through the status byte, multiple APDU commands or large-capacity data can be automatically transferred between the mobile terminal and the smart card.
虽然移动终端与智能卡都支持上述机制, 但由于这些命令或机制都属于 硬件底层命令, 并没有完全对上层应用开放。 因此, 移动终端的上层应用软 件无法利用这种数据传输机制。 尤其是主动式命令, 需要智能卡和移动终端 同时都支持时才能使用。 发明内容  Although both the mobile terminal and the smart card support the above mechanism, since these commands or mechanisms belong to the underlying hardware commands, they are not completely open to the upper layer application. Therefore, the upper layer application software of the mobile terminal cannot utilize this data transmission mechanism. In particular, proactive commands are required when both smart cards and mobile terminals are supported. Summary of the invention
本发明需要解决的技术问题是提供一种移动终端与智能卡之间的大容量 数据交换方法, 能够使移动终端应用直接与智能卡交换大容量数据, 并进一 步保证数据传输的完整性和有效性。  The technical problem to be solved by the present invention is to provide a large-capacity data exchange method between a mobile terminal and a smart card, which enables the mobile terminal application to directly exchange large-capacity data with the smart card, and further ensures the integrity and validity of the data transmission.
本发明的上述技术问题这样解决, 提供一种移动终端与智能卡之间的大 容量数据交换方法, 包括以下步骤:  The above technical problem of the present invention is solved by the present invention to provide a large-capacity data exchange method between a mobile terminal and a smart card, comprising the following steps:
1.1)利用通用 APDU命令建立移动终端与智能卡之间的数据传输通道; 解决一致性和兼容性问题; 能卡文件的协议令牌建立具体逻辑通道; 1.3)利用所述数据传输通道和具体逻辑通道分块传输其各分块大小符合 标准规定的大容量数据。 1.1) Using a general APDU command to establish a data transmission channel between the mobile terminal and the smart card; solving the consistency and compatibility problems; establishing a specific logical channel for the protocol token of the card file; 1.3) Using the data transmission channel and the specific logical channel to block the large-capacity data whose block size meets the standard requirements.
按照本发明提供的数据交换方法, 所述通用 APDU命令包括对移动终端 应用开放的更新二进制 UPDATE BINARY APDU命令及其响应和读二进制 READ BINARY APDU命令及其响应; 所述更新二进制 UPDATE BINARY APDU命令和读二进制 READ BINARY APDU命令响应携带被传输数据。  According to the data exchange method provided by the present invention, the universal APDU command includes an update binary UPDATE BINARY APDU command and its response and a read binary READ BINARY APDU command and its response open to the mobile terminal application; the update binary UPDATE BINARY APDU command and The read binary READ BINARY APDU command response carries the transmitted data.
按照本发明提供的数据交换方法, 所述分块包括所述大容量数据的分割 块单元以及对应协议令牌单元; 其中最后一个分块包括结束标志。  According to the data exchange method provided by the present invention, the partition includes a partition block unit of the large-capacity data and a corresponding protocol token unit; wherein the last block includes an end flag.
按照本发明提供的数据交换方法, 所述分块还包括下一个数据块长度单 元, 所述下一个数据块长度单元的值为 0是传输结束标志, 所述传输结束标 志包括但不限制于该方式。  According to the data exchange method provided by the present invention, the partition further includes a next data block length unit, and a value of 0 of the next data block length unit is a transmission end flag, and the transmission end flag includes but is not limited to the the way.
按照本发明提供的数据交换方法, 所述分块还可包括数据校验单元, 所 述步骤 1.3)包括发送方的计算校验值, 并将该校验值封装到所述校验单元, 和接收方根据所述数据校验单元进行接收数据校验的过程。  According to the data exchange method provided by the present invention, the block may further include a data check unit, the step 1.3) includes a calculated check value of the sender, and the check value is encapsulated into the check unit, and The receiving side performs a process of receiving data verification according to the data verification unit.
按照本发明提供的数据交换方法, 移动终端应用向智能卡进行数据传输 时, 所述步骤 1.3)包括智能卡利用 APDU命令响应的状态字节 SW1/SW2向 移动终端应用发送命令执行和校验成功 /失败。 按照本发明提供的数据交换方 法, 所述步骤 1.3)还可包括命令执行或校验失败后进行重传; 所述重传包括 利用所述读二进制 READ BINARY APDU命令及其响应获取错误状态记录文 件并分析错误状态记录决定是否重传。  According to the data exchange method provided by the present invention, when the mobile terminal application performs data transmission to the smart card, the step 1.3) includes the smart card transmitting the command execution and verification success/failure to the mobile terminal application by using the status byte SW1/SW2 of the APDU command response. . According to the data exchange method provided by the present invention, the step 1.3) may further include performing retransmission after the command execution or the verification failure; the retransmission includes acquiring the error status record file by using the read binary READ BINARY APDU command and the response thereof. And analyze the error status record to decide whether to retransmit.
按照本发明提供的数据交换方法, 每一个所述分块包括与自身数据对应 的数据校验单元。  According to the data exchange method provided by the present invention, each of said blocks includes a data check unit corresponding to its own data.
按照本发明提供的数据交换方法, 每多个所述分块包括一个与该多个所 述分块对应的数据校验单元, 可节省数据校验单元, 多传输有效数据。  According to the data exchange method provided by the present invention, each of the plurality of segments includes a data check unit corresponding to the plurality of the blocks, which saves the data check unit and transmits the valid data.
按照本发明提供的数据交换方法, 每一个所述分块包括与本块及其存在 的前一分块对应的数据校验单元, 即第一分块的数据校验单元与自身的数据 对应, 其他与两分块的数据对应, 校验时与前一分块结合校验, 这样进一步 保证数据链接的正确性。 按照本发明提供的数据交换方法, 每多个所述分块包括一个与本多个分 块及其存在的前一个分块对应的数据校验单元, 即最先传输的多个分块的数 据校验单元与自身的多个分块数据对应, 其他多个分块的数据校验单元与本 多个分块以及前一个分块的数据相对应, 校验时与前一个分块结合校验, 这 样, 不仅进一步保证数据链接的正确性, 还可以节省校验单元。 According to the data exchange method provided by the present invention, each of the partitions includes a data check unit corresponding to the block and the previous block existing therein, that is, the data check unit of the first block corresponds to its own data. Others correspond to the data of the two blocks, and the checksum is combined with the previous block to verify the correctness of the data link. According to the data exchange method provided by the present invention, each of the plurality of blocks includes a data check unit corresponding to the plurality of blocks and a previous block existing therein, that is, data of a plurality of blocks transmitted first. The check unit corresponds to a plurality of block data of the plurality of blocks, and the data check unit of the plurality of other blocks corresponds to the data of the plurality of blocks and the previous block, and the checksum is combined with the check of the previous block. In this way, not only the correctness of the data link is further ensured, but also the verification unit can be saved.
按照本发明提供的数据交换方法, 所述标准是 ISO/IEC 7816标准, 所述 标准规定每条 APDU最大传输数据可以是 256字节或 64k字节。  According to the data exchange method provided by the present invention, the standard is the ISO/IEC 7816 standard, which specifies that the maximum transmission data per APDU may be 256 bytes or 64 kbytes.
按照本发明提供的数据交换方法, 在 GSM协议中, 所述标准规定每条 APDU最大传输数据是 256字节。  According to the data exchange method provided by the present invention, in the GSM protocol, the standard specifies that the maximum transmission data per APDU is 256 bytes.
本发明提供的移动终端与智能卡之间大容量数据交换方法, 通过釆用通 用 APDU命令, 在移动终端与智能卡之间建立统一数据传输通道, 进一步釆 用数据封装和隧道协议的方法, 解决利用标准 ISO/IEC 7816接口进行大容量 数据传输问题, 釆用本发明方法, 具有以下明显效果:  The large-capacity data exchange method between the mobile terminal and the smart card provided by the invention establishes a unified data transmission channel between the mobile terminal and the smart card by using the general APDU command, and further adopts a data encapsulation and tunneling protocol method to solve the utilization standard. The ISO/IEC 7816 interface for large-capacity data transmission problems, using the method of the present invention, has the following significant effects:
1 )移动终端可以直接访问智能卡内的任意数据, 同时不用考虑是否存在 硬件兼容性的问题;  1) The mobile terminal can directly access any data in the smart card without considering whether there is a problem of hardware compatibility;
2 )移动终端与智能卡之间可以可靠地传输大容量数据, 以实现各种基于 智能卡的应用;  2) Large-capacity data can be reliably transmitted between the mobile terminal and the smart card to implement various smart card-based applications;
3 )移动终端可以釆用文件系统的操作方式直接访问智能卡数据, 极大地 方便了应用的实现。 附图说明  3) The mobile terminal can directly access the smart card data by using the operation mode of the file system, which greatly facilitates the implementation of the application. DRAWINGS
下面结合附图和具体实施例进一步对本发明进行详细说明。  The invention will be further described in detail below with reference to the drawings and specific embodiments.
图 1为传统移动终端应用访问智能卡数据的结构示意图;  FIG. 1 is a schematic structural diagram of a conventional mobile terminal application accessing smart card data;
图 2为本发明的移动终端应用访问智能卡数据的访问模型示意图; 图 3为本发明的数据包格式说明;  2 is a schematic diagram of an access model of a mobile terminal application accessing smart card data according to the present invention; FIG. 3 is a description of a data packet format of the present invention;
图 4为本发明的数据封装过程示意图;  4 is a schematic diagram of a data encapsulation process of the present invention;
图 5为本发明的移动终端向智能卡传输大容量数据的流程示意图; 图 6为本发明的移动终端向智能卡传输大容量数据时出错处理流程示意 图; 5 is a schematic flowchart of a mobile terminal transmitting large-capacity data to a smart card according to the present invention; 6 is a schematic flowchart of an error processing process when a mobile terminal transmits large-capacity data to a smart card according to the present invention;
图 7为本发明的移动终端从智能卡获取大容量数据的流程示意图; 图 8为本发明的移动终端从智能卡获取大容量数据时出错处理流程示意 图。  7 is a schematic flowchart of a mobile terminal acquiring large-capacity data from a smart card according to the present invention; and FIG. 8 is a schematic diagram showing an error processing flow when the mobile terminal acquires large-capacity data from a smart card according to the present invention.
具体实施方式 detailed description
首先, 说明本发明移动终端与智能卡之间大容量数据交换方法中移动终 端应用访问智能卡数据方式与目前方式的区别, 本发明模型如图 2所示, 在 目前方式(图 1 ) 的基础上, 利用通用的 APDU命令, 在移动终端与智能卡 之间建立起通用的数据传输通道。 移动终端上层应用釆用通用的 APDU命令 直接访问智能卡进行大数据量传输, 而不釆用 STK命令或 AT命令; 以避免 图 1中可能由于软件(如 STK虚拟机)接口或硬件接口 (如 AT命令) 引起 的不兼容性。  First, the difference between the method for accessing the smart card data by the mobile terminal application in the large-capacity data exchange method between the mobile terminal and the smart card of the present invention is compared with the current mode. The model of the present invention is shown in FIG. 2, and is utilized on the basis of the current mode (FIG. 1). The universal APDU command establishes a common data transmission channel between the mobile terminal and the smart card. The upper layer of the mobile terminal uses the general APDU command to directly access the smart card for large data transmission without using STK commands or AT commands; to avoid the possibility of software (such as STK virtual machine) interface or hardware interface (such as AT) in Figure 1. Command) caused incompatibility.
第二步, 说明本发明思路和主要手段:  The second step illustrates the idea and main means of the invention:
( )釆用对上层应用开放的通用 APDU命令: 如釆用读二进制 READ BINARY和更新二进制 UPDATE BINARY的命令来实现大容量数据传输。  ( ) Use the generic APDU command that is open to the upper application: For example, read the binary READ BINARY and update the binary UPDATE BINARY command to achieve large-capacity data transfer.
(二)建立逻辑通道: 由于移动终端与智能卡均可以支持多种应用, 因此, 在移动终端与智能卡之间也需要建立与多种应用同时进行数据传输的机制。 议令牌, 代表不同的应用或文件。  (2) Establishing a logical channel: Since both the mobile terminal and the smart card can support multiple applications, a mechanism for simultaneously transmitting data with multiple applications is also required between the mobile terminal and the smart card. A token that represents a different application or file.
(≡)使用 "下一个数据块长度标识" : 由于移动终端对底层命令的屏蔽, 往往也无法使用 0x9FXX、 0x9EXX和 0x91XX等状态字来告诉接收端数据是 否已经传输完成。 因此, 本发明在每个数据包的传输标识中釆用 "下一个数 据块长度标识" 来说明本次数据传输是否完成, 以指示是否需要继续发送 APDU命令。 接收端可以根据 "下一个数据块长度标识" 来决定是否需要继 续进行 APDU传输。 当 "下一个数据块长度标识"值为 0x00时, 表示没有数 据可传, 本次传输结束; 当 "下一个数据块长度标识" 值为非零时, 则表示 下一个 APDU命令需要传送的字节数。 通过这种机制, 可以实现自动完成大 容量数据的传送任务。 (≡) Use "Next Data Block Length Identifier": Due to the mobile terminal's shielding of the underlying commands, it is often impossible to use status words such as 0x9FXX, 0x9EXX, and 0x91XX to tell the receiver whether the data has been transferred. Therefore, the present invention uses the "next data block length identifier" in the transmission identifier of each data packet to indicate whether the current data transmission is completed, to indicate whether it is necessary to continue to transmit the APDU command. The receiving end can decide whether to continue the APDU transmission according to the "next data block length identifier". When the value of "Next Data Block Length Identifier" is 0x00, it means that no data can be transmitted, and this transfer ends; when the "Next Data Block Length Identifier" value is non-zero, it means The number of bytes that need to be transferred by the next APDU command. Through this mechanism, it is possible to automate the transfer of large-capacity data.
(四)校验: 由于大容量数据需要利用多次 APDU来传输, 而且, 每次传输 的数据量也相对较大。 因此, 为了保证数据的完整性以及可靠性, 需要加入 数据校验机制: 即每发送 n ( n > 1 )条 APDU命令, 传输 n块数据后, 对这 n 块数据进行校验, 当校验发现数据错误时, 则重传 n块数据。 最后传输的数 据块数 k n。 当 n=l时, 每传输一块数据就校验一次, 当发现校验错误时, 发送端重发本次 APDU命令, 及时地纠正出错的数据。 当 n为所有要传输的 数据块时, 只需在传输完毕后对所有的数据进行一次校验, 但是校验一旦发 现数据错误, 则需要重传所有的数据块。  (4) Verification: Since large-capacity data needs to be transmitted using multiple APDUs, the amount of data transmitted each time is relatively large. Therefore, in order to ensure the integrity and reliability of the data, a data verification mechanism needs to be added: that is, each n (n > 1) APDU command is sent, and after n pieces of data are transmitted, the n pieces of data are verified, when the check is performed. When data is found to be incorrect, n blocks of data are retransmitted. The number of data blocks transmitted last k n . When n=l, each piece of data is checked once. When a check error is found, the sender resends the APDU command and corrects the erroneous data in time. When n is all the data blocks to be transmitted, all the data needs to be verified once after the transfer is completed, but once the data error is found, all the data blocks need to be retransmitted.
ω级联校验: 由于大文件需要分解为多个数据块进行传输, 为了防止数 据合并出错, 进一步, 本发明釆用级联验证方法: 除最先传输的 η ( η > 1 ) 块数据外, 生成对应的数据校验值时, 是对前一次传输的一块数据和本 η块 数据一起计算校验值。 这样, 最先传输的 η块数据的校验值是利用该 η块数 据计算校验值, 后续传输的 η块数据的校验值是利用前一次传输的一块数据 和本传输的 η块数据共 η+1块数据计算校验值,对最后传输的 k η块数据计 算校验值时, 是利用前一次传输的一块数据和本传输的 k块数据共 k+1块数 据计算校验值。 验证时, 需要将本传输的 n块或 k块数据与前一次传输的一 块数据一起合并计算校验值, 从而可以防止数据链路出错。 (六)状态字节 SW1/SW2重定义: 在移动终端应用作接收方时, 可直接通 过校验成功与否判断是否传输成功, 但对于移动终端应用作发送方时, 由于 在釆用 APDU进行数据传输时, APDU命令响应的状态字节 SW1/SW2只能 表明本次 APDU命令是否成功执行, 无法向移动终端应用表明本次更新二进 制文件的传输是否成功, 即无法判断数据校验成功。 因此, 本发明仍然釆用 状态字节来表示更新二进制文件 APDU命令执行状态,返回 0x9000状态字节 时, 表示传输和校验均成功; 当返回其它值, 则说明传输或校验出错, 暂停 数据传输, 并将错误状态或信息写到一个记录错误状态的文件中, 然后返回 传输失败的状态字节, 等待发送端发送查询操作状态的指令, 然后根据情况 决定是否重发数据或中止传输。 同样地, 查询操作状态的指令也是通过常用 的 APDU命令读取特定的错误状态记录文件来实现的。 Ω cascading check: Since large files need to be decomposed into multiple data blocks for transmission, in order to prevent data merging errors, the present invention further uses cascading verification methods: except for the first transmitted η ( η > 1 ) block data When the corresponding data check value is generated, the check value is calculated together with the piece of data of the previous transmission and the η block data. In this way, the check value of the first transmitted n block data is calculated by using the n block data, and the check value of the subsequently transmitted n block data is obtained by using the previous piece of data and the transmitted n block data. The η+1 block data is used to calculate the check value, and when the check value is calculated for the last transmitted k η block data, the check value is calculated by using the block data of the previous transmission and the k block data of the transmission to be k+1 block data. During verification, it is necessary to combine the n-block or k-block data of this transmission with the data of the previous transmission to calculate the check value, thereby preventing data link errors. (6) State byte SW1/SW2 redefinition: When the mobile terminal is used as the receiver, it can directly judge whether the transmission is successful by verifying the success or not, but when the mobile terminal is used as the sender, it is performed by using the APDU. During the data transmission, the status byte SW1/SW2 of the APDU command response can only indicate whether the APDU command is successfully executed. It cannot indicate to the mobile terminal that the transmission of the update binary file is successful, that is, the data verification cannot be determined successfully. Therefore, the present invention still uses the status byte to indicate the update status of the binary file APDU command. When the 0x9000 status byte is returned, it indicates that both the transmission and the verification are successful; when other values are returned, the transmission or verification error occurs, and the data is suspended. Transfer, and write the error status or information to a file that records the error status, then return the status byte of the transmission failure, wait for the sender to send an instruction to query the operation status, and then according to the situation Decide whether to resend the data or abort the transfer. Similarly, instructions for querying the operational status are also implemented by reading a specific error status log file using a common APDU command.
第三步, 详细说明本发明移动终端与智能卡之间大容量数据交换方法具 体可以釆用的一种数据包格式及其对应数据封装过程:  The third step is a detailed description of a data packet format and a corresponding data encapsulation process that can be applied to the large-capacity data exchange method between the mobile terminal and the smart card of the present invention:
( )数据包格式,如图 3所示,该数据包 DATA最大 256字节,封装在 APDU 命令中, 包括 2字节的传输标识、 最多 250字节的数据块和 4字节的 CRC32 校验值,其中传输标识包括 1字节的逻辑通道和 1字节的下一个数据块长度, 下一个数据块长度为 00时, 本次是最后一次传输。  ( ) Packet format, as shown in Figure 3, the packet DATA is up to 256 bytes, encapsulated in the APDU command, including 2 bytes of transmission identification, up to 250 bytes of data block and 4 bytes of CRC32 check Value, where the transmission identifier includes a 1-byte logical channel and a 1-byte next data block length. When the next data block length is 00, this is the last transmission.
(二)数据封装过程, 如图 4所示, 包括以下步骤:  (2) The data encapsulation process, as shown in Figure 4, includes the following steps:
401 )数据分块和计算校验值: 对所有要传输的数据进行分块处理, 分解 成适合 APDU命令传送的大小, 并对传输的数据生成级联校验码;  401) Data blocking and calculating check value: performing block processing on all data to be transmitted, decomposing into a size suitable for APDU command transmission, and generating a cascading check code for the transmitted data;
402 ) - 407 )给加入级联校验码的数据块打上相应的传输标识进行封装, 最后将封装好的数据包作为 APDU命令中的数据体 Data进行传送,直至将所 有的数据包传送完毕。  402) - 407) The data block to which the cascading check code is added is tagged with the corresponding transport identifier, and finally the encapsulated data packet is transmitted as the data body Data in the APDU command until all the data packets are transmitted.
当 n=l时, 对传输的每一块数据都生成级联校验码, 将所述校验码、 传 输标识和传输的该块数据进行封装; 当 11>1时, 对传输的 n块数据生成一个 级联校验码, 将所述校验码、 传输标识和 n块数据的一个数据块进行封装, 例如 n块数据的最后一个数据块, 将传输标识和其余 n-1块数据进行封装; 最后传输的数据块 k n, 对传输的 k块数据生成一个级联校验码, 将所述校 验码、 传输标识和 k块数据的一个数据块进行封装, 例如 k块数据的最后一 个数据块, 将传输标识和其余 k-1块数据进行封装。  When n=l, a cascading check code is generated for each piece of data transmitted, and the check code, the transmission identifier, and the transmitted block data are encapsulated; when 11>1, n pieces of data are transmitted. Generating a cascading check code, and encapsulating the check code, the transmission identifier, and a data block of n pieces of data, for example, the last data block of the n pieces of data, and encapsulating the transmission identifier and the remaining n-1 pieces of data The last transmitted data block kn, generates a cascode check code for the transmitted k block data, and encapsulates the check code, the transmission identifier and a data block of the k block data, for example, the last data of the k block data. The block encapsulates the transport identifier and the remaining k-1 block data.
最后, 以釆用 Windows Mobile操作系统的智能移动终端作为实例对本发 明方法进行详细说明:  Finally, the method of the present invention is described in detail by using an intelligent mobile terminal using the Windows Mobile operating system as an example:
(一) Windows Mobile基础  (1) Windows Mobile Foundation
①在 Windows Mobile操作系统中, 其提供了 SIM Manager API来实现与 1 In the Windows Mobile operating system, it provides the SIM Manager API to achieve
SIM卡的数据交互。 在 simmgr.h头文件中定义了部分函数, 用于从 SIM卡获 取信息, 按功能进行分类, 这些函数主要包括安全、 电话簿、 短信、 文件等 几大类。 可以与 SIM卡进行数据交换的函数主要是电话簿、 短信、 记录 /文件 三类操作函数。 电话本、 短信两类函数主要是是针对特定的数据结构, 如电 话簿、 短信, 提供出来的, 不适用于自定义数据结构; 如果需要传输自定义 的数据结构, 则釆用记录 /文件类操作函数比较合适。 SIM card data interaction. Part of the function is defined in the simmgr.h header file, which is used to obtain information from the SIM card and classify by function. These functions mainly include security, phone book, short message, file and so on. The functions that can exchange data with the SIM card are mainly phone book, text message, record/file Three types of operation functions. Two types of functions, phonebook and SMS, are mainly provided for specific data structures, such as phone book and text message, and are not applicable to custom data structures. If you need to transfer a custom data structure, use the record/file class. The operation function is more appropriate.
②在 Windows Mobile中,支持 ISO/IEC 7816-4和 GSM 11.11规定的多种 基本文件结构:  2 In Windows Mobile, support a variety of basic file structures specified by ISO/IEC 7816-4 and GSM 11.11:
1、 透明文件: 从接口看到的文件是一个数据单元序列;  1, transparent file: The file seen from the interface is a sequence of data units;
2、 线性定长记录文件: 具有固定长度记录的线性文件;  2, linear fixed length record file: a linear file with a fixed length record;
3、 线性不定长记录文件: 具有可变长度记录的线性文件;  3, linear variable length record file: a linear file with variable length records;
4、 具有固定长度记录的循环文件;  4. A loop file with a fixed length record;
具体的文件类型编码如下:  The specific file type encoding is as follows:
Figure imgf000012_0001
Figure imgf000012_0001
(二)其他基础  (2) Other foundations
本发明用读 /写 /更新透明文件的方式来实现数据交换,通过连续多次的操 作来实现大容量数据的交换。 GSM11.11 中与之对应的 APDU命令为 READ BINARY和 UPDATE BINARY, 相应的格式如下:  The present invention implements data exchange by means of reading/writing/updating transparent files, and realizes exchange of large-capacity data by successive operations. The corresponding APDU commands in GSM11.11 are READ BINARY and UPDATE BINARY. The corresponding format is as follows:
Figure imgf000012_0002
Figure imgf000012_0002
响应参数 /数据如下:  The response parameters / data are as follows:
Bit位 描述 长度
Figure imgf000013_0001
Bit bit description length
Figure imgf000013_0001
在 Windows Mobile 系统中, 上述透明文件的读写功能是通过 SimReadRecord和 SimWriteRecord两个函数来完成。 由于这两个函数与上述 的 APDU命令——对应, 因此, 为简明起见, 下面以 GSM协议中的 APDU 命令为例进行说明。  In the Windows Mobile system, the above-mentioned transparent file read and write function is completed by two functions SimReadRecord and SimWriteRecord. Since these two functions correspond to the APDU command described above, for the sake of brevity, the following uses the APDU command in the GSM protocol as an example.
①硬件要求:由于遵从 ISO/IEC7816规范的 SIM卡的文件大小不超过 64k 字节, 而本发明所要传输的文件大小不应受任何限制。 因此, 需要 SIM卡的 文件系统支持超过 64k字节容量的文件, 这可以通过釆用通用的文件系统, 如 FAT16/32来实现。 SIM卡操作系统及其文件系统的实现问题不在本发明讨 论之列, 因此, 若无特殊说明, 本发明所指的 SIM卡是指已经具备这种大容 量(超过 64k字节)文件访问功能的 SIM卡。 目前, 移动终端的文件系统都 支持超过 64k字节的文件, 因此, 本发明对移动终端没有特殊要求。  1 Hardware requirements: Since the file size of the SIM card conforming to the ISO/IEC 7816 specification does not exceed 64 kbytes, the file size to be transmitted by the present invention should not be subject to any limitation. Therefore, the file system that requires the SIM card supports files larger than 64 kbytes, which can be achieved by using a common file system such as FAT16/32. The implementation problem of the SIM card operating system and its file system is not discussed in the present invention. Therefore, unless otherwise stated, the SIM card referred to in the present invention refers to a file access function having such a large capacity (more than 64 kbytes). SIM card. At present, the file system of the mobile terminal supports files exceeding 64 kbytes. Therefore, the present invention has no special requirements for mobile terminals.
② APDU命令: 移动终端与 SIM卡之间的数据交换可以是双向的, 既可 以由移动终端向 SIM卡传输数据, 也可以由 SIM卡向移动终端传输数据。但 由于 APDU命令是主从结构, 通常是移动终端主动发送 APDU命令, SIM卡 被动接收和执行 APDU命令, 并返回执行结果。 因此, 在此实施例中, 为了 保持对现有技术的兼容性和适应性,仍然以移动终端作为主动者,发送 APDU 命令; SIM卡作为从动者, 接收 APDIL 当移动终端需要向 SIM卡传输数据 时, 移动终端主动发送 APDU命令。 当需要从 SIM卡中读取数据时, 也是由 移动终端主动发起读取数据的 APDU命令。 对于支持主动式命令的移动终端 和 SIM卡, 可以釆用相同的设计原理, 通过对 ENVELOPE和 FETCH等相关 指令进行功能扩展, 也可以实现大容量任意数据的传输和交换。 考虑到移动 终端上层应用对主动式命令支持和开放的局限性, 为了尽量扩大使用范围, 提高兼容性, 本实施例以传统的 (GSM 11.11协议中指定的) APDU命令来 例来实现任意格式的数据传输和交换。  2 APDU command: The data exchange between the mobile terminal and the SIM card may be bidirectional, and the data may be transmitted by the mobile terminal to the SIM card, or may be transmitted by the SIM card to the mobile terminal. However, since the APDU command is a master-slave structure, usually the mobile terminal actively sends an APDU command, and the SIM card passively receives and executes the APDU command, and returns the execution result. Therefore, in this embodiment, in order to maintain compatibility and adaptability to the prior art, the mobile terminal is still the active party, and the APDU command is sent; the SIM card acts as the slave, and receives the APDIL. When the mobile terminal needs to transmit to the SIM card, When the data is received, the mobile terminal actively sends an APDU command. When it is necessary to read data from the SIM card, it is also an APDU command that the mobile terminal actively initiates reading data. For mobile terminals and SIM cards that support active commands, the same design principle can be used. By extending the functions of ENVELOPE and FETCH, it is also possible to transfer and exchange large amounts of arbitrary data. Considering the limitation of active command support and openness of the upper layer application of the mobile terminal, in order to maximize the scope of use and improve compatibility, this embodiment uses a conventional (defined in the GSM 11.11 protocol) APDU command to implement an arbitrary format. Data transmission and exchange.
③数据校验和重传: 在本发明的实施例中, 如果数据传输出错, 则可以 重发上次传输的数据; 同时也需要在每次 APDU传送完成后告诉接收端传输 数据是否已经传完, 是否需要继续传输。 为此, 为每块需要传送的数据附以 相应的传输标识和校验值, 数据包格式如图 3所示, 最前面 2个字节为传输 标识,最后 4个字节为 CRC32校验值,中间为所要传输的可变长度的数据块, 最长 250字节。 传输标识包括两个字节, 第一个字节为逻辑通道, 表明本次 传输的协议令牌。 第二个字节为下一个数据块长度标识, 用于表明下一次 APDU需要传输的字节数, 最大为 250字节; 当其值为 0x00时, 表示已无数 据可传, 本次数据传输过程结束; 当其值为非零值(不超过 OxFA )时, 则表 明还有数据需要继续传送,同时也说明下一个 APDU命令需要传送多少字节。 数据块釆用 CRC32算法进行校验, 釆用级联方式, 除第一块数据的校验值就 是它本身的校验值外, 其它块的校验值则是本块与前一块两块数据级联结果 的校验值。 3 data checksum retransmission: In the embodiment of the present invention, if the data transmission error occurs, the last data transmitted may be retransmitted; and it is also required to tell the receiving end whether the data has been transmitted after each APDU transmission is completed. , Do you need to continue the transfer. To this end, for each piece of data that needs to be transmitted with the corresponding transmission identification and check value, the data packet format is shown in Figure 3, the first two bytes are transmission Identification, the last 4 bytes are the CRC32 check value, and the middle is the variable length data block to be transmitted, up to 250 bytes. The transmission identifier consists of two bytes, the first byte being a logical channel, indicating the protocol token of this transmission. The second byte is the next data block length identifier, which is used to indicate the number of bytes that the next APDU needs to transmit, and the maximum is 250 bytes. When the value is 0x00, it means that no data can be transmitted. This data transmission The process ends; when its value is non-zero (not exceeding OxFA), it indicates that there is still data to continue to transmit, and also indicates how many bytes need to be transferred by the next APDU command. The data block is verified by the CRC32 algorithm, and the cascading mode is used. Except that the check value of the first block is its own check value, the check value of other blocks is the block and the previous block. The check value of the cascaded result.
(≡)具体实施, 本发明移动终端与智能卡之间大容量数据交换方法具体包 括移动终端向 SIM卡和 SIM卡向移动终端两个方向传输大容量数据,具体有 四种情况, 分别说明如下:  (≡) Specifically, the method for large-capacity data exchange between the mobile terminal and the smart card of the present invention specifically includes the mobile terminal transmitting large-capacity data to the SIM card and the SIM card to the mobile terminal in two directions, and there are four specific cases, which are respectively described as follows:
情况一: 如图 5所示, 当移动终端向 SIM卡传输大容量数据时, 连续多 次地发送 UPDATE BINARY命令 , 以实现大容量数据传输 , SIM卡接收到 由移动终端发送的数据包时, 对数据包进行拆包处理, 获取相应的数据块, 并对其进行校验; 校验成功后, 返回成功执行的状态字节, 移动终端接收到 成功执行的响应 APDU后, 继续发送余下的数据, 直至将所有的数据包发送 午。  Case 1: As shown in FIG. 5, when the mobile terminal transmits large-capacity data to the SIM card, the UPDATE BINARY command is sent multiple times in succession to realize large-capacity data transmission, and when the SIM card receives the data packet sent by the mobile terminal, The data packet is unpacked, the corresponding data block is obtained, and the data block is verified; after the verification succeeds, the status byte of the successful execution is returned, and after receiving the successfully executed response APDU, the mobile terminal continues to send the remaining data. Until all packets are sent in the afternoon.
情况二: 如图 6所示, 当移动终端向 SIM卡传输大容量数据时, 连续多 次地发送 UPDATE BINARY命令, 以实现大容量数据传输, SIM卡接收到 由移动终端发送的数据包时, 对数据包进行拆包处理, 获取相应的数据块, 并对其进行校验; 校验失败后, 返回执行失败的状态字节, 并将有关失败的 原因写入用于记录错误状态的文件 0x2FA2 , 移动终端接收到失败的响应 APDU , 则暂停发送下一条 APDU命令, 改为读取记录错误状态的文件 0x2FA2, 分析原因后决定是否重发或停止。  Case 2: As shown in FIG. 6, when the mobile terminal transmits large-capacity data to the SIM card, the UPDATE BINARY command is sent multiple times in succession to realize large-capacity data transmission, and when the SIM card receives the data packet sent by the mobile terminal, The data packet is unpacked, the corresponding data block is obtained, and the data block is verified; after the verification fails, the status byte of the execution failure is returned, and the reason for the failure is written to the file 0x2FA2 for recording the error status. When the mobile terminal receives the failed response APDU, it suspends sending the next APDU command, and reads the file 0x2FA2 of the recording error state, and determines whether to resend or stop after analyzing the cause.
情况一和情况二中, SIM卡每接收成功一条 APDU命令, 就将接收的数 据块写入到大容量数据文件中保存起来, 直至数据最后传完为止。  In case 1 and case 2, each time the SIM card receives an APDU command, the received data block is written to the large-capacity data file and saved until the data is finally transmitted.
情况三和情况四: 由于 SIM卡只能被动地接受 APDU命令, 因此, 当需 要从 SIM卡内读出数据时,仍然需要由移动终端主动发送 APDU命令 READ BINARY, 通过多次读取特定文件(形成专用的 APDU命令 )的方式来实现。 由于每次 APDU命令传送的最大数据容量为 256字节,因此,每次传递完 256 字节后, 需要由 SIM卡操作系统负责及时地更新 APDU命令中的数据, 以便 于移动终端读取后面的数据。数据更新的操作完全由 SIM卡操作系统来完成。 这既可以通过文件系统来完成,也可以釆用 GSM协议中更新透明文件的方式 来实现。 这样, 每执行一次 APDU命令后, 就及时更新需要传输的 APDU数 据, 重复多次更新和读取, 就可以实现大容量数据的传输, 流程如图 6所示。 当移动终端校验数据失败后, 需要将出错信息写入到 SIM卡内的错误状态记 录文件, 以通知 SIM卡进行相应的处理。 SIM卡处理完毕后, 返回执行成功 的响应 APDU。 之后, 移动终端就可以重新向 SIM卡发送读二进制文件的 APDU命令 READ BINARY, 以从 SIM卡中获取数据,有关流程如图 Ί所示。 Case 3 and Case 4: Since the SIM card can only passively accept the APDU command, when the data needs to be read from the SIM card, the APDU command READ still needs to be actively sent by the mobile terminal. BINARY is implemented by reading a specific file multiple times (forming a dedicated APDU command). Since the maximum data capacity transmitted by each APDU command is 256 bytes, it is necessary for the SIM card operating system to update the data in the APDU command in time after the 256 bytes are transmitted, so that the mobile terminal can read the latter. data. The operation of data update is completely done by the SIM card operating system. This can be done either through the file system or by updating the transparent file in the GSM protocol. In this way, after each APDU command is executed, the APDU data to be transmitted is updated in time, and the update and the read are repeated multiple times, so that large-capacity data can be transmitted. The process is as shown in FIG. 6. After the mobile terminal fails to verify the data, it needs to write the error information to the error status record file in the SIM card to notify the SIM card to perform corresponding processing. After the SIM card is processed, a successful response APDU is returned. After that, the mobile terminal can re-send the APDU command READ BINARY of the read binary file to the SIM card to obtain data from the SIM card, as shown in FIG.

Claims

权 利 要 求 Rights request
1、 一种移动终端与智能卡之间的大容量数据交换方法, 其特征在于, 包括以下步骤: A large-capacity data exchange method between a mobile terminal and a smart card, comprising the steps of:
1.1) 利用通用 APDU命令建立移动终端与智能卡之间的数据传输通 道; 智能卡文件的协议令牌建立具体逻辑通道、; 5 ' " 1.3) 利用所述数据传输通道和具体逻辑通道分块传输其各分块大小符 合标准规定的大容量数据。 1.1) using a general APDU command to establish a data transmission channel between the mobile terminal and the smart card; the protocol token of the smart card file establishes a specific logical channel; 5 '" 1.3) using the data transmission channel and the specific logical channel to block each of its transmission The block size conforms to the large-capacity data specified by the standard.
2、 根据权利要求 1所述数据交换方法, 其特征在于, 所述通用 APDU 命令包括对移动终端应用开放的读二进制 READ BINART APDU命令及其响 应和更新二进制 UPDATE BINARY APDU命令及其响应。 2. The data exchange method according to claim 1, wherein said universal APDU command comprises an open read binary READ BINART APDU command to the mobile terminal application, and a response and update binary UPDATE BINARY APDU command and response thereof.
3、 根据权利要求 1所述数据交换方法,其特征在于, 所述分块包括所 述大容量数据的分割块单元以及对应协议令牌单元; 其中最后一个分块包括 结束标志。 The data exchange method according to claim 1, wherein the partition includes a divided block unit of the large-capacity data and a corresponding protocol token unit; wherein the last block includes an end flag.
4、 根据权利要求 3所述数据交换方法,其特征在于, 所述分块还包括 下一个数据块长度单元, 所述下一个数据块长度单元的值为 0时表示所述结 束标志。 The data exchange method according to claim 3, wherein the partition further includes a next data block length unit, and the value of the next data block length unit indicates 0, and the end flag is indicated.
5、 根据权利要求 3或 4所述数据交换方法,其特征在于, 所述分块还 可包括数据校验单元, 所述步骤 1.3)包括发送方计算校验值, 并将校验值封 装到所述校验单元, 和接收方根据所述数据校验单元进行接收数据校验的过 程。 The data exchange method according to claim 3 or 4, wherein the block further comprises a data check unit, wherein the step 1.3) comprises the sender calculating the check value, and encapsulating the check value into The verification unit, and the receiving party perform a process of receiving data verification according to the data verification unit.
6、 根据权利要求 5所述数据交换方法,其特征在于,移动终端应用向 智能卡进行数据传输时, 所述步骤 1.3)包括智能卡利用 APDU命令响应的状 态字节向移动终端应用发送命令执行和校验成功 /失败。 The data exchange method according to claim 5, wherein when the mobile terminal application performs data transmission to the smart card, the step 1.3) includes the smart card transmitting a command execution and a calibration to the mobile terminal application by using a status byte of the APDU command response. Success/failure.
7、 根据权利要求 6 所述数据交换方法, 其特征在于, 所述步骤 1.3) 还可包括命令执行或校验失败后进行重传; 所述重传包括利用所述读二进制 READ BINARY APDU命令及其响应获取错误状态记录文件。 The data exchange method according to claim 6, wherein the step 1.3) may further include re-transmission after command execution or verification failure; and the retransmission includes using the read binary The READ BINARY APDU command and its response get the error status log file.
8、 根据权利要求 5所述数据交换方法,其特征在于,每一个所述分块 包括与自身数据对应的数据校验单元。  The data exchange method according to claim 5, characterized in that each of said blocks includes a data check unit corresponding to its own data.
9、 根据权利要求 5所述数据交换方法,其特征在于,每多个所述分块 包括与该多个所述分块的数据对应的数据校验单元。  The data exchange method according to claim 5, characterized in that each of said plurality of said blocks comprises a data check unit corresponding to data of said plurality of said blocks.
10、 根据权利要求 5所述数据交换方法,其特征在于,每一个所述分块 包括与本块及其存在的前一分块的数据对应的数据校验单元。  The data exchange method according to claim 5, characterized in that each of said blocks includes a data check unit corresponding to the data of the block and the previous block in which it exists.
11、 根据权利要求 5所述数据交换方法,其特征在于,每多个所述分块 包括与本多个分块及其存在的前一个分块的数据对应的数据校验单元。  The data exchange method according to claim 5, characterized in that each of said plurality of said blocks includes a data check unit corresponding to data of said plurality of blocks and a previous block thereof.
PCT/CN2007/070890 2007-06-06 2007-10-12 Method for exchanging large-capacity data between mobile terminal and smart card WO2008148278A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200710110448.9 2007-06-06
CN2007101104489A CN101321336B (en) 2007-06-06 2007-06-06 High-capacity data interchange method between mobile terminal and smart card

Publications (1)

Publication Number Publication Date
WO2008148278A1 true WO2008148278A1 (en) 2008-12-11

Family

ID=40093149

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2007/070890 WO2008148278A1 (en) 2007-06-06 2007-10-12 Method for exchanging large-capacity data between mobile terminal and smart card

Country Status (2)

Country Link
CN (1) CN101321336B (en)
WO (1) WO2008148278A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103595870A (en) * 2013-11-21 2014-02-19 深圳中科讯联科技有限公司 Method for having control over communication of mobile phone through radio frequency card swiping mode
WO2015062503A1 (en) * 2013-11-04 2015-05-07 上海数字电视国家工程研究中心有限公司 Data packet encapsulation method and check method
CN108012256A (en) * 2016-10-28 2018-05-08 中移(杭州)信息技术有限公司 A kind of communication means and device of dummy general subscriber identification module

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101466163B (en) * 2008-12-31 2012-06-27 华为终端有限公司 Method and system for processing information and relevant equipment
CN101448043B (en) * 2009-01-08 2013-07-03 中兴通讯股份有限公司 Multimedia terminal and method for interaction between application side and wireless side therein
CN101827140B (en) * 2009-03-03 2014-06-18 展讯通信(上海)有限公司 Method for writing data in user identification module card and mobile terminal
CN101605322B (en) * 2009-07-24 2013-03-13 北京握奇数据系统有限公司 Method and device for terminal processing of air personalized services
CN102184374A (en) * 2011-03-24 2011-09-14 北京握奇数据系统有限公司 Method and device for downloading file based on Java intelligent card
CN102567771B (en) * 2011-12-07 2014-12-24 北京握奇数据系统有限公司 Method and system for operating smart card, smart card and terminal
CN103581879A (en) * 2012-07-31 2014-02-12 中国电信股份有限公司 Method and system for performing data transmission between terminal and user identification card
CN102916790B (en) * 2012-08-30 2015-12-02 招商银行股份有限公司 The error treating method of smart card personalization, controller and system
CN104836639B (en) * 2015-04-02 2018-04-27 中国科学院信息工程研究所 A kind of data transmission method for transmitting many algorithms parameter
CN106302808A (en) * 2016-09-14 2017-01-04 广东欧珀移动通信有限公司 Data transmission method and mobile terminal
CN107948941A (en) * 2017-10-30 2018-04-20 中国联合网络通信集团有限公司 A kind of method and apparatus of short message processing
CN111241017B (en) * 2020-01-08 2021-07-09 北京江南天安科技有限公司 Data transmission method and device of multi-channel PSAM card and multi-channel PSAM card
CN113541865A (en) * 2021-06-21 2021-10-22 浙江中控技术股份有限公司 Configuration transmission method and device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6278885B1 (en) * 1997-08-25 2001-08-21 Alcatel Mobile phone using subscriber identification card for updating information stored therein
CN1889735A (en) * 2006-07-28 2007-01-03 凤凰微电子(中国)有限公司 Method and system for realizing multimedia playing on cell phone terminal via SIM card

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100608826B1 (en) * 2004-08-28 2006-08-09 엘지전자 주식회사 Data access method for mobile communication device
CN100452907C (en) * 2006-08-22 2009-01-14 凤凰微电子(中国)有限公司 Data transmission method and device between user identification module and mobile terminal

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6278885B1 (en) * 1997-08-25 2001-08-21 Alcatel Mobile phone using subscriber identification card for updating information stored therein
CN1889735A (en) * 2006-07-28 2007-01-03 凤凰微电子(中国)有限公司 Method and system for realizing multimedia playing on cell phone terminal via SIM card

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015062503A1 (en) * 2013-11-04 2015-05-07 上海数字电视国家工程研究中心有限公司 Data packet encapsulation method and check method
CN103595870A (en) * 2013-11-21 2014-02-19 深圳中科讯联科技有限公司 Method for having control over communication of mobile phone through radio frequency card swiping mode
CN108012256A (en) * 2016-10-28 2018-05-08 中移(杭州)信息技术有限公司 A kind of communication means and device of dummy general subscriber identification module

Also Published As

Publication number Publication date
CN101321336A (en) 2008-12-10
CN101321336B (en) 2012-11-14

Similar Documents

Publication Publication Date Title
WO2008148278A1 (en) Method for exchanging large-capacity data between mobile terminal and smart card
US9332577B2 (en) Method and system for implementing smart card remote operation
US9497620B2 (en) Method and system for implementing smart card remote operation based on smart card web server
US7725103B2 (en) Mobile communication device dynamic service application and dynamic service application scripting
EP2566288B1 (en) Wireless internet access module, communication method for host and wireless internet access module
BRPI0823384B1 (en) METHOD TO TRANSFER AN APPLICATION TO A TELECOMMUNICATION TERMINAL
WO2010096994A1 (en) System and method for downloading application
CN101814971A (en) Method for transmitting mobile phone file
CN110213020A (en) Data transmission method, terminal, system and device based on bluetooth peripheral hardware
US7571374B2 (en) Method for transmitting and processing command and data
JP2009182459A (en) Communication device, communication system, communication method, and program
CN103580726B (en) User identification card, Bluetooth device and method for accessing user identification card
JP4173862B2 (en) How to load applications deployed in terminals and chip cards
CN105553607A (en) Effective data transmission of wireless SIM card transmission protocol
WO2011160475A1 (en) Method for automatically correcting short message service center number and terminal for sending short message
CN112565031B (en) Parameter configuration method and terminal for PPP connection
JP2008107991A (en) Information processing medium, program therefor, error processing method for information processing medium, and information processing system
CN115729879A (en) Data frame format, chip communication method and chip
TWI434582B (en) Mobile station, base station, transmission method and computer program product thereof
WO2022116015A1 (en) Data processing method and apparatus, electronic device, and storage medium
CN114172897B (en) Method and system for transmitting files of PC (personal computer) end and Android end
KR101247601B1 (en) Method of storing a message based on a status information of the message, and mobile communication terminal
WO2015029559A1 (en) Communications system
EP1566941A1 (en) Method and device for enabling mono- and bi-directional communication between mobile equipment and smartcard applications
Tiedemann nfcpy documentation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 07817081

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 07817081

Country of ref document: EP

Kind code of ref document: A1