目录

Reading Private Data from the Target App After Authentication

Before reading data from a pass, the pass reader needs to be authenticated by the pass. The pass reader uses the card_key of the target pass to encrypt the random number generated by the applet in AES 128 CBC mode. The applet decrypts and verifies the random number.

  1. Generate a 16-byte AES IV and write it to the EF10 file.
    Select the EF10 file.
    00A4000002EF10

    Write the AES IV to the EF10 file in LV format, where L indicates the length and V indicates the value. For example, the IV FF6A7D01AC09C16198844D8FE15102CF is written to the file as 10FF6A7D01AC09C16198844D8FE15102CF.

    00D600001110FF6A7D01AC09C16198844D8FE15102CF
  2. Read the 16-byte random number generated by the applet.
    0084000010

    Encrypt the random number in AES/CBC/NoPadding mode using the card_key of the target pass. Define the encryption result as encryStr.

    The generation mode of card_key is user-defined. Ensure that the card_key used by the pass reader to encrypt the random number is the same as the card_key delivered by your server.

  3. Send the external authentication instruction in format of "0082000310"+encryStr.
    00820003100B0740D3B02E6FD66FD25D5A1C362E3F resp : 9000

    If the operation is successful, 9000 is returned.

  4. Read personalized data from the pass.

    The following table describes the data.

    Name

    Identifier

    File

    Maximum Length (Bytes)

    Function

    Pass certificate

    card_certificate

    EF01

    2048

    Pass certificate provided by the pass issuer.

    Pass ID

    card_id

    EF02

    128

    Unique ID of a pass provided by the pass issuer.

    Private pass information

    card_privateInfo

    EF03

    256

    Private information about a pass, for example, the validity period and permissions.

    The following is an example. If 9000 is returned, the operation is successful.
    // Select the EF01 file.
    00A4000002EF01 resp : 9000
    // Read the EF01 file, which contains 2048 bytes at most.
    00B00000FF resp : xxxxx
    00B000FFFF resp : xxxxx
    00B001FEFF resp : xxxxx
    00B002FDFF resp : xxxxx
    00B003FCFF resp : xxxxx
    00B004FBFF resp : xxxxx
    00B005FAFF resp : xxxxx
    00B006F9FF resp : xxxxx
    00B007F808 resp : xxxxx
    
    // Select the EF02 file.
    00A4000002EF02 resp : 9000
    // Read the EF02 file, which contains 128 bytes at most.
    00B0000080 resp : xxxxx
    
    // Select the EF03 file.
    00A4000002EF03 resp : 9000
    // Read the EF03 file, which contains 256 bytes at most.
    00B00000FF resp : xxxxx
    00B000FF01 resp : xxxxx