打印

有谁有iso/iec 7816-5 和iso/iec 13239的specification吗?

[复制链接]
3347|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
张允|  楼主 | 2007-7-3 17:38 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
张允|  楼主 | 2007-7-3 17:54 | 只看该作者

没有人知道吗?

使用特权

评论回复
板凳
张允|  楼主 | 2007-7-3 18:06 | 只看该作者

找到一些,不知道是不是:

   Table 7: Bit rate afjustment factor D
     -------

     -------------------------------------------------------
        DI | 0000  0001  0010  0011  0100  0101  0110  0111
     ------+------------------------------------------------
        D  |  RFU     1     2     4     8    16   RFU   RFU
     -------------------------------------------------------

     -------------------------------------------------------
        DI | 1000  1001  1010  1011  1100  1101  1110  1111
     ------+------------------------------------------------
        D  |  RFU   RFU   1/2   1/4   1/8  1/16  1/32  1/64
     -------------------------------------------------------
      RFU : Reserved for Future Use


     - Programming voltage factor P
       ----------------------------

     PI1 from 5 to 25 gives the value of P in volts. PI1=0 indicates that VPP
     is connected in the card which generates an internal programming voltage
     from VCC. Other values of PI1 are reserved for future use.

     When PI2 is present, the indication of PI1 should be ignores. PI2 from
     50 to 250 gives the value of P in 0.1V. Other values of PI2 are reserved
     for future use.


     Table 8 : Maximum programming current factor I
     -------
     -------------------------------
      II  |   00    01    10    11
     -----+-------------------------
      I   |   25    50   100   RFU
     -------------------------------

     - Extra guardtime N
       -----------------

     N codes directly the extra guard time, from 0 to 254 etu. N=255
     indicates that the minimum delay between the start edges of two
     consecutives characters is reduced to 11 etu.


   b - Answer to Reset in synchronous transmission
       -------------------------------------------
   * Clock frequency and bit rate
     """"""""""""""""""""""""""""
     There is a linear relationship between the bit rate on the I/O line and
     the clock frequency provided by the clock interface device on CLK.

     Any clock frequency between 7kHz and 50kHz may be chosen for the reset
     sequence. A clock frequency of 7kHz corresponds to 7kbit/s, and values
     of the clock frequency up to 50kHz cause corresponding bit rates to be
     transmitted.

   * Structure of the header of the Answer to Reset
     """"""""""""""""""""""""""""""""""""""""""""""
     The reset operation results in an answer from the card containing a
     header transmitted from the card to the interface. The header has a
     fixed length of 32 bits and begins with two mandatory fields of 8 bits,
     H1 and H2.

     The chronological order of transmission of information bits shall
     correcpond to bit identification b1 to b32 with the least significant
     bit transmitted first. The numerical meaning corresponding to each
     information bit considered in isolation is that of the digit.

           - 0 for a unit corresponding to state A (space)
           - 1 for a unit corresponding to state Z (mark)

   * Timing of the haeder
     """"""""""""""""""""
     After the reset procedure, the output information is controlled by clock
     pulses. The first clock pulse is applied between 10us and 100us (t14)
     after the falling edge on RST to read the data bits from the card. State
     H of the clock pulses can be varied between 10us and 50us (t15) and
     state L between 10us and 100us (t16).

     The first data bit is obtained on I/O while the clock is low and is
     valid 10us (t13) at least after the falling edge on RST. The following
     data bits are valid 10us (t17) at least after the falling edge on CLK.
     Each data bit is valid until the next falling edge the following clock
     pulse on CLK. The data bits can therefore be sampled at the rising edge
     of the following clock pulses.

   * Data content of the header
     """"""""""""""""""""""""""
     The header allows a quick determination of whelther the card and the
     interface device are compatible. If there is no compatibility, the
     contacts shall be desactivated.

     The first field H1 codes the protocol type. The values of the codes and
     the corresponding protocol type are

          Hexadecimal value   protocol type
          -----------------------------------
           00 and ff          not to be used
           01 to FE           each value is assigned
                              by ISO/IEC JTC1/SC17 to
                              one protocol type

     The second field H2 codes parameters for the protocol type coded in
     field H1. The values of H2 are to be assigned by ISO/IEC JTC1/SC17.


   2.3.5) Protocol type selection (PTS)
          -----------------------------
   If only one protocol type and FI=D=1 (default value of TA1) and N smaller
   than 255 is indicated in the answer to reset. The transmission protocol
   associated to the protocol type may be started immediately after the
   transmission of answer to reset.

   If more than one protocol type and/or TA1 parameter values other than the
   default values and/or N equeal to 255 is/are indicated in the answer to
   reset, the card shall know unambiguously, after having sent the answer to
   reset, which protocol type or/and transmission parameter values (FI, D, N)
   will be used. Consequently a selection of the protocol type and/or the
   transmission parameters values shall be specified.

   If the card is able to process more than one protocol type and if one of
   those protocol types is indicated as T=0, then the protocol type T=0 shall
   indicated in TD1 as the first offered protocol, and is assumed if no PTS
   is performed.

   If a card offers more than one protocol and if the interface device
   supports only one of these protocols which is not T=0 and does not support
   PTS, the interface should reject or reset the card.

   2.3.5.a - PTS protocol
             ------------
   Only the interface device is permitted to start a PTS procedure:

      - The interface device sends a PTS request to the card.
      - If the card receives a correct PTS request, it answers by sending a
        PTS confirm, if implemented or the initial waiting time will be
        exceeded.
      - After the succesfull exchange of PTS request and PTS confirm, data
        shall be transmitted from the interface device using the selected
        protocol type and/or transmission parameters.
      - If the card receives an erronous PTS request, it will not send a PTS
        confirm.
      - If the initial waiting time is exceeded, the interface device should
        resetor reject the card.
      - If the interface device receives an erroneous PTS confirm, it should
        reset or reject the card.

   The parameters for the transmission of the PTS request and PTS confirm
   shall correspond to those used within the Answer to Reset regarding the
   bit rate and the convention detected by TS and possibly modified by TC1.

   2.3.5.b - Structure and content of PTS request and PTS confirm
             ----------------------------------------------------
   The PTS request and PTS response each consist of one initial character
   PTSS, followed by a format character PTS0, three optional parameter
   characters PTS1 PTS2 PTS3, and a character check PCK at the last byte.

   PTSS identifies the PTS request or PTS confirm and is coded FF.

   PTS0 indicates by the bits b5, b6, b7 set to 1 the presence of the
   subsequently sent optional characters PTS1, PTS2, PTS3 respectively. It
   codes over the least significant bits b4 to b1 the selected protocol type
   T as coded in TD bytes. The most significant bit b8 (default b8=0) is
   reserved for future use.

   PTS1 codes the parameter values FI and D as coded in TA1. The interface
   device may send PTS1 in order to indicate the selection FI and/or D values
   to the card. If PTS1 is not sent, FI=1 and D=1 are assumed as defaults.
   The card either acknowledges both the FI and D values by echoing PTS1 or
   does not send PTS1 indicating the use of the default values.

   PTS2 indicates the support of N=255, when bit b1 is set to 1. Bit b1 set
   to 0 is the default and indicates that the 11 etu period is not used. If
   bit b2 is set to 1, the card shall use an extra guardtime of 12 etu for
   its transmssion of characters to the interface device. Bit b2 set to 0 is
   the default and indicates that no extra guardtime is required. Bit b3 to
   b8 are reserved for future use.

   If PTS2 is sent by the interface device and is not echoed by the card, the
   interface device should reject or reset the card.

   The coding and use of PTS3 is not defined.

   The value of PCK shall be such that the exclusive-oring of all charcters
   from PTSS to PCK included is null.


   2.3.6) Protocol type T=0, asynchronous half duplex character transmission
          protocol----------------------------------------------------------
          --------
   This clause defines the structure and processing of commands initiated by
   an interface device for transmission control and for card specific control
   in an asynchronous half duplex character transmission protocol.

   This protocol uses the parameters indicated by the answer to reset, unless
   modified by the protocol type selection.

   2.3.6.a - Specific interface parameters: the work waiting time
             ----------------------------------------------------
   In an answer to reset, the interface character TC2 codes the integer value
   WI over eight bits b8 to b1. When no TC2 appears in the answer to reset,
   the default value of WI is 10.

   The interval between the start leading edge of any character sent by the
   card and the start leading edge of the previous character (sent either by
   the card or by the interface device) shall not exceed 960*OWI work etu.
   This maximum delay is named the work waiting time.

   2.3.6.b - Structure and processing of commands
             ------------------------------------
   A command is always initiated by the interface device. It tells the card
   what to do in a 5-byte header, and allow a transfer of data bytes under
   control of procedure bytes sent by the card.

   It is assumed that the card and the interface device know a priori the
   direction of data, in order to ditinguish between instructions for
   incoming data transfer (where data enter the card during execution) and
   instructions for outgoing data transfers (where data leave the card during
   execution).


without parity error
--------------------

        Start                                    Start
   _____    _____________________________________    ___________
        |  |  |  |  Byte i   |  |  |P |          |  |  Byte i+1
        |__|__|__|__|__|__|__|__|__|__| guartime |__|___________

                                   Even
with a parity error               parity
-------------------                bit
        Start                                        Start
   _____    ______________________________ Error   __    ___________
        |  |  |  |  Byte i   |  |  |P |  | signal |  |  |  Byte i+1
        |__|__|__|__|__|__|__|__|__|__|  |________|  |__|___________


           Figure 8 : Byte transmission diagram
           --------

   * Command header sent by the interface device
     """""""""""""""""""""""""""""""""""""""""""
     The interface device transmits a header over five successive bytes
     designated CLA, INS, A1, A2, L.

     - CLA is an instruction class. The value FF is reserved for PTS.

     - INS is an instruction code in the instruction class. The instruction
       code is valid only if the least significant bit is 0, and the most
       significant half byte is neither 6 nor 9.

     - P1, P2 are a reference (e.g. an address) completing the instruction
       code

     - P3 codes the number n of data bytes (D1, ... , Dn) which are to be
       transmitted during the command. The direction of movement of these
       data is a function of the instruction. In an outgoing data transfer
       command, P3=0 introduces a 256 byte data transfer from the card. In an
       incoming data transfer command, P3=0 introduces no transfer of data.

     All remaining encoding possibilities for the header are specified in
     subsequent parts of ISO7816.

     After transmission of such 5 byte header, the interface device waits for
     a procedure byte.

   * Procedure bytes sent by the card
     """"""""""""""""""""""""""""""""
     The value of the procedure bytes shall indicate the action requested by
     the interface device. Three types of procedure bytes are specified:

     - ACK : (The seven most significant bits in an ACK byte are all equal or
       complementary to those in the INS byte, apart from the values 6x and
       9x) The interface device control VPP state and exchanges data
       depending on ACK values.

     - NULL : (=$60) This byte is sent by the card to restart the working
       time, end to anticipate a subsequent procedure byte. It requests no
       further action neither on VPP nor on Data.

     - SW1 (= $6x or $9x, expect $60); The interface device maintains or sets
       VPP at idle and waits for a SW2 byte to complete the command.

     Any transition of VPP state (active/idle) must occur within the
     guardtime of the procedure byte, or on the work waiting time overflow.

     At each procedure byte, the card can proceed with the command by an ACK
     or NULL byte, or show its disaproval by becoming unresponsive, or
     conclude by an end sequence SW1-SW2.

  Byte | Value |  Result
  -----+-------+------------------------------------------------------------
       | INS   | VPP is idle. All remaining data bytes are transferred
       |       | subsequently.
       |       |
       | INS+1 | VPP is active. All remaining data bytes are transferred
       |       | subsequently.
  ACK  | ___   |
       | INS   | VPP is idle. Next data byte is transferred subsequently.
       | _____ |
       | INS+1 | VPP is active. Newt data byte is transferred subsequently.
  -----+-------+------------------------------------------------------------
  NULL | $60   | No futher action on VPP. The interface device waits for a
       |       | new procedure byte
  -----+-------+------------------------------------------------------------
  SW1  | SW1   | VPP is idle. The interface device waits for a SW2 byte


     Acknoledge bytes
     ----------------
     The ACK bytes are used to control VPP state and data transfer.

       - When exclusive-oring the ACK byte with the INS byte gives $00 or
         $FF, the interface device maintains or sets VPP as idle.

       - When exclusive-oring the ACK byte with the INS byte gives $01 or
         $FE, the interface device maintains or sets VPP as active.

       - When the seven most significant bits in the ACK byte have the same
         value as those in the INS byte, all remaining data bytes (Di, ...,
         Dn) if any remain, are transferred subsequently.

       - When the seven most significant bits in the ACK byte are
         complementary to those in the INS byte, only the next data byte
         (Di), if one remains is transferred.

     After these actions, the interface device waits for a new procedure.

     Null byte (= $60)
     -----------------
     This byte is sent by the card to reset the workwaiting time and to
     anticipate a subsequent procedure byte.

     Status bytes (SW1=$6x or $9x, expect $60; SW2 any value)
     --------------------------------------------------------
     The end sequence SW1-SW2 gives the card status at the end of the command.

     The normal ending is indicated by SW1-SW2 = $90-$00.

     When the most significant half byte SW1 is $6, the meaning of SW1 is
     independant of the application. The following five values are defined:

       $6E The card does not support the instruction class.
       $6D The instruction code is not programmed or is invalid.
       $6B The reference is incorrect.
       $67 The length is incorrect.
       $6F No precise diagnostic is given.

     Other values are reserved for future use by ISO7816.
     When SW1 is neither $6E nor $6D, the card support the instruction.
     This part of ISO7816 does not interprets neither $9X SW1 bytes, nor SW2
     bytes; Their meaning relates to the application itself.

     Supplement (were seen sometimes):
     ---------------------------------
     SW1  SW2  Meaning

     62   81   Returned data may be corrupted.
     62   82   The end of the file has been reached before the end of reading.
     62   84   Selected file is not valid.
     65   01   Memory failure. There have been problems in writing or reading
               the EEPROM. Other hardware problems may also bring this error.
     68   00   The request function is not supported by the card.
     6A   00   Bytes P1 and/or P2 are incorrect.
     6A   80   The parameters in the data field are incorrect.
     6A   82   File not found.
     6A   83   Record not found.
     6A   84   There is insufficient memory space in record or file.
     6A   87   The P3 value is not consistent with the P1 and P2 values.
     6A   88   Referenced data not found.
     6C   XX   Incorrect P3 length.

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

39

主题

400

帖子

0

粉丝